diff --git a/fit/src/test/java/org/apache/olingo/fit/base/MetadataTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/MetadataTestITCase.java index 62906c8ab..3f970dd84 100644 --- a/fit/src/test/java/org/apache/olingo/fit/base/MetadataTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/base/MetadataTestITCase.java @@ -6,9 +6,9 @@ * 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 @@ -132,8 +132,8 @@ public class MetadataTestITCase extends AbstractTestITCase { final EdmTerm scale = edm.getTerm(new FullQualifiedName("UoM.Scale")); assertNotNull(scale); - final EdmAnnotation requiresTypeInScale = edm.getAnnotation( - scale.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Core.RequiresType"))); + final EdmAnnotation requiresTypeInScale = + scale.getAnnotation(edm.getTerm(new FullQualifiedName("Core.RequiresType"))); assertNotNull(requiresTypeInScale); assertEquals("Edm.Decimal", requiresTypeInScale.getExpression().asConstant().getValueAsString()); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java index 1571a13d2..e2dcd8073 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java @@ -22,13 +22,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.apache.olingo.commons.api.ex.ODataException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider; import org.apache.olingo.commons.api.edm.provider.CsdlAction; import org.apache.olingo.commons.api.edm.provider.CsdlActionImport; import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo; -import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable; import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations; import org.apache.olingo.commons.api.edm.provider.CsdlComplexType; import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer; @@ -42,6 +40,7 @@ import org.apache.olingo.commons.api.edm.provider.CsdlSchema; import org.apache.olingo.commons.api.edm.provider.CsdlSingleton; import org.apache.olingo.commons.api.edm.provider.CsdlTerm; import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition; +import org.apache.olingo.commons.api.ex.ODataException; public class ClientCsdlEdmProvider extends CsdlAbstractEdmProvider { @@ -200,13 +199,4 @@ public class ClientCsdlEdmProvider extends CsdlAbstractEdmProvider { } return null; } - - @Override - public CsdlAnnotatable getAnnotatable(FullQualifiedName annotatedName) throws ODataException { - final CsdlSchema schema = xmlSchemas.get(annotatedName.getNamespace()); - if (schema != null) { - return schema.getAnnotatables().get(annotatedName.getName()); - } - return null; - } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java index cdd0e215f..f40de28fc 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java @@ -164,21 +164,4 @@ public interface Edm { * @return {@link EdmAnnotations} */ EdmAnnotations getAnnotationGroup(FullQualifiedName targetName); - - /** - * Get all {@link EdmAnnotation} by element FQN. - * - * @param annotatableName must not be null - * @return {@link EdmAnnotation} - */ - List getAnnotations(FullQualifiedName annotatableName); - - /** - * Get {@link EdmAnnotation} by element FQN and term. - * - * @param annotatableName must not be null - * @param term edm:Annotation term - * @return {@link EdmAnnotation} - */ - EdmAnnotation getAnnotation(FullQualifiedName annotatableName, EdmTerm term); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java index ba2e7b46f..a4754a6a0 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java @@ -112,9 +112,4 @@ public abstract class CsdlAbstractEdmProvider implements CsdlEdmProvider { public CsdlAnnotations getAnnotationsGroup(final FullQualifiedName targetName) throws ODataException { return null; } - - @Override - public CsdlAnnotatable getAnnotatable(final FullQualifiedName annotatedName) throws ODataException { - return null; - } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java index 0bcb1ccc4..b38a2a42e 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java @@ -179,13 +179,4 @@ public interface CsdlEdmProvider { * @throws ODataException the o data exception */ CsdlAnnotations getAnnotationsGroup(FullQualifiedName targetName) throws ODataException; - - /** - * Gets annotatable. - * - * @param annotatedName full qualified name of annotatable - * @return Annotatable element by target name - * @throws ODataException the o data exception - */ - CsdlAnnotatable getAnnotatable(FullQualifiedName annotatedName) throws ODataException; } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlSchema.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlSchema.java index efb1b715c..a3996c576 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlSchema.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlSchema.java @@ -19,9 +19,7 @@ package org.apache.olingo.commons.api.edm.provider; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * The type Csdl schema. @@ -54,8 +52,6 @@ public class CsdlSchema extends CsdlAbstractEdmItem implements CsdlAnnotatable { private final List annotations = new ArrayList(); - private Map annotatables; - /** * Gets namespace. * @@ -369,61 +365,4 @@ public class CsdlSchema extends CsdlAbstractEdmItem implements CsdlAnnotatable { public List getAnnotations() { return annotations; } - - /** - * Gets annotatables. - * - * @return the annotatables - */ - public Map getAnnotatables() { - if (annotatables == null) { - annotatables = new HashMap(); - for (CsdlAnnotations annotationGroup : getAnnotationGroups()) { - annotatables.put(null, annotationGroup); - } - for (CsdlAnnotation annotation : getAnnotations()) { - annotatables.put(annotation.getTerm(), annotation); - } - for (CsdlAction action : getActions()) { - annotatables.put(action.getName(), action); - } - for (CsdlComplexType complexType : getComplexTypes()) { - annotatables.put(complexType.getName(), complexType); - } - for (CsdlEntityType entityType : getEntityTypes()) { - annotatables.put(entityType.getName(), entityType); - } - for (CsdlEnumType enumType : getEnumTypes()) { - annotatables.put(enumType.getName(), enumType); - } - for (CsdlFunction function : getFunctions()) { - annotatables.put(function.getName(), function); - } - for (CsdlTerm term : getTerms()) { - annotatables.put(term.getName(), term); - } - for (CsdlTypeDefinition typedef : getTypeDefinitions()) { - annotatables.put(typedef.getName(), typedef); - } - if (entityContainer != null) { - annotatables.put(entityContainer.getName(), entityContainer); - for (CsdlAnnotation annotation : entityContainer.getAnnotations()) { - annotatables.put(annotation.getTerm(), annotation); - } - for (CsdlActionImport actionImport : entityContainer.getActionImports()) { - annotatables.put(actionImport.getName(), actionImport); - } - for (CsdlFunctionImport functionImport : entityContainer.getFunctionImports()) { - annotatables.put(functionImport.getName(), functionImport); - } - for (CsdlEntitySet entitySet : entityContainer.getEntitySets()) { - annotatables.put(entitySet.getName(), entitySet); - } - for (CsdlSingleton singleton : entityContainer.getSingletons()) { - annotatables.put(singleton.getName(), singleton); - } - } - } - return annotatables; - } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java index 5bc581038..d3b287e31 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java @@ -26,7 +26,6 @@ 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.EdmAnnotation; import org.apache.olingo.commons.api.edm.EdmAnnotations; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityContainer; @@ -80,9 +79,6 @@ public abstract class AbstractEdm implements Edm { private final Map annotationGroups = Collections.synchronizedMap(new HashMap()); - private final Map> annotations = - Collections.synchronizedMap(new HashMap>()); - private Map aliasToNamespaceInfo = Collections.synchronizedMap(new HashMap()); private boolean aliasToNamespaceInfoCreated = false; @@ -311,33 +307,6 @@ public abstract class AbstractEdm implements Edm { return _annotations; } - @Override - public List getAnnotations(final FullQualifiedName annotatableName) { - final FullQualifiedName fqn = resolvePossibleAlias(annotatableName); - List _annotations = annotations.get(fqn); - if (_annotations == null) { - _annotations = createAnnotations(fqn); - if (_annotations != null) { - annotations.put(fqn, _annotations); - } - } - return _annotations; - } - - @Override - public EdmAnnotation getAnnotation(final FullQualifiedName annotatableName, final EdmTerm term) { - final List _annotations = getAnnotations(annotatableName); - EdmAnnotation result = null; - if (_annotations != null) { - for (EdmAnnotation annotation : _annotations) { - if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) { - result = annotation; - } - } - } - return result; - } - private FullQualifiedName resolvePossibleAlias(final FullQualifiedName namespaceOrAliasFQN) { if (!aliasToNamespaceInfoCreated) { aliasToNamespaceInfo = createAliasToNamespaceInfo(); @@ -446,10 +415,4 @@ public abstract class AbstractEdm implements Edm { final EdmAnnotations annotationsGroup) { annotationGroups.put(annotationsGroupName, annotationsGroup); } - - protected abstract List createAnnotations(FullQualifiedName annotatedName); - - // public void cacheAnnotation(FullQualifiedName annotationsGroupName, EdmAnnotations annotationsGroup) { - // annotationGroups.put(annotationsGroupName, annotationsGroup); - // } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java index 1ad719414..c4ab9271b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java @@ -358,23 +358,4 @@ public class EdmProviderImpl extends AbstractEdm { throw new EdmException(e); } } - - @Override - protected List createAnnotations(final FullQualifiedName annotatedName) { - try { - CsdlAnnotatable providerAnnotatable = provider.getAnnotatable(annotatedName); - if (providerAnnotatable != null && providerAnnotatable.getAnnotations() != null) { - List result = new ArrayList(); - for (CsdlAnnotation annotation : providerAnnotatable.getAnnotations()) { - // Load Term - getTerm(new FullQualifiedName(annotation.getTerm())); - result.add(new EdmAnnotationImpl(this, annotation)); - } - return result; - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } } diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java index 6a14de725..2efe38a71 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java @@ -425,10 +425,5 @@ public class EdmImplCachingTest { protected EdmAnnotations createAnnotationGroup(final FullQualifiedName target) { throw new UnsupportedOperationException("Not supported yet."); } - - @Override - protected List createAnnotations(final FullQualifiedName annotatedName) { - throw new UnsupportedOperationException("Not supported yet."); - } } } diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java index 7470f0425..23f2235af 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCallCreateTest.java @@ -289,10 +289,5 @@ public class EdmImplCallCreateTest { protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) { throw new UnsupportedOperationException("Not supported yet."); } - - @Override - protected List createAnnotations(final FullQualifiedName annotatedName) { - throw new UnsupportedOperationException("Not supported yet."); - } } } diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java index 2fe8aa3e8..fb8ec8b8d 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java @@ -22,12 +22,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.apache.olingo.commons.api.ex.ODataException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.provider.CsdlAction; import org.apache.olingo.commons.api.edm.provider.CsdlActionImport; import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo; -import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable; import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations; import org.apache.olingo.commons.api.edm.provider.CsdlComplexType; import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider; @@ -42,6 +40,7 @@ import org.apache.olingo.commons.api.edm.provider.CsdlSchema; import org.apache.olingo.commons.api.edm.provider.CsdlSingleton; import org.apache.olingo.commons.api.edm.provider.CsdlTerm; import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition; +import org.apache.olingo.commons.api.ex.ODataException; public class SchemaBasedEdmProvider implements CsdlEdmProvider { private final List edmSchemas = new ArrayList(); @@ -307,9 +306,4 @@ public class SchemaBasedEdmProvider implements CsdlEdmProvider { public CsdlAnnotations getAnnotationsGroup(FullQualifiedName targetName) throws ODataException { return null; } - - @Override - public CsdlAnnotatable getAnnotatable(FullQualifiedName annotatedName) throws ODataException { - return null; - } }