olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [2/2] olingo-odata4 git commit: [OLINGO-562] Initial contribution from Thierry
Date Mon, 15 Jun 2015 07:26:17 GMT
[OLINGO-562] Initial contribution from Thierry


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/f4a1f434
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/f4a1f434
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/f4a1f434

Branch: refs/heads/OLINGO-562_SpringExtension
Commit: f4a1f4345334ba5b7892d67718c87244af681096
Parents: 5501e8e
Author: Michael Bolz <michael.bolz@sap.com>
Authored: Mon Jun 15 09:21:43 2015 +0200
Committer: Michael Bolz <michael.bolz@sap.com>
Committed: Mon Jun 15 09:21:43 2015 +0200

----------------------------------------------------------------------
 ext/olingo-ext-spring/pom.xml                   | 122 +++++++++
 .../olingo/ext/spring/OlingoSpringServlet.java  |  88 ++++++
 .../config/OlingoEdmBeanDefinitionHelper.java   | 266 +++++++++++++++++++
 .../OlingoEdmProviderBeanDefinitionParser.java  |  36 +++
 .../OlingoHandlerBeanDefinitionHelper.java      | 158 +++++++++++
 .../OlingoHttpHandlerBeanDefinitionParser.java  |  36 +++
 .../spring/config/OlingoNamespaceHandler.java   |  61 +++++
 .../spring/editor/FullQualifiedNameEditor.java  |  34 +++
 .../ext/spring/edm/GenericEdmProvider.java      | 254 ++++++++++++++++++
 .../factory/EdmxReferenceFactoryBean.java       |  80 ++++++
 .../ext/spring/factory/ODataFactoryBean.java    |  41 +++
 .../factory/ODataHttpHandlerFactoryBean.java    |  94 +++++++
 .../factory/ServiceMetadataFactoryBean.java     |  92 +++++++
 .../src/main/resources/META-INF/spring.handlers |   1 +
 .../src/main/resources/META-INF/spring.schemas  |   1 +
 .../olingo/ext/spring/config/spring-olingo.xsd  | 118 ++++++++
 ...ngOlingoEdmProviderWithoutNamespaceTest.java |  85 ++++++
 ...ngOlingoHttpHandlerWithoutNamespaceTest.java |  41 +++
 .../SpringOlingoNamespaceEdmProviderTest.java   | 105 ++++++++
 .../SpringOlingoNamespaceHttpHandlerTest.java   |  41 +++
 .../olingo/ext/spring/config/TestProcessor.java |  33 +++
 .../integration/OlingoSpringTestServlet.java    |  36 +++
 .../SpringOlingoNamespaceIntegrationTest.java   | 153 +++++++++++
 .../applicationContext-edm-provider-beans.xml   |  86 ++++++
 ...pplicationContext-edm-provider-namespace.xml |  64 +++++
 .../applicationContext-http-handler-beans.xml   |  73 +++++
 ...pplicationContext-http-handler-namespace.xml |  40 +++
 .../resources/applicationContext-namespace.xml  |  58 ++++
 28 files changed, 2297 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/pom.xml
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/pom.xml b/ext/olingo-ext-spring/pom.xml
new file mode 100644
index 0000000..24fd338
--- /dev/null
+++ b/ext/olingo-ext-spring/pom.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>org.apache.olingo.ext</groupId>
+	<artifactId>org.apache.olingo.ext.spring</artifactId>
+	<name>${project.artifactId}</name>
+	<packaging>jar</packaging>
+	<version>1.0.0-snapshot</version>
+
+	<properties>
+		<servlet-version>2.5</servlet-version>
+		<olingo-version>4.0.0-beta-02</olingo-version>
+		<spring-version>4.1.3.RELEASE</spring-version>
+		<slf4j-version>1.7.7</slf4j-version>
+		<jetty-version>9.3.0.M1</jetty-version>
+		<junit-version>4.4</junit-version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>${servlet-version}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>odata-server-api</artifactId>
+			<version>${olingo-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>odata-server-core</artifactId>
+			<version>${olingo-version}</version>
+			<scope>runtime</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>odata-commons-api</artifactId>
+			<version>${olingo-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>odata-commons-core</artifactId>
+			<version>${olingo-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>odata-client-core</artifactId>
+			<version>${olingo-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.olingo</groupId>
+			<artifactId>odata-client-api</artifactId>
+			<version>${olingo-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-simple</artifactId>
+			<version>${slf4j-version}</version>
+			<scope>runtime</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context</artifactId>
+			<version>${spring-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-web</artifactId>
+			<version>${spring-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-server</artifactId>
+			<version>${jetty-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-http</artifactId>
+			<version>${jetty-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-servlet</artifactId>
+			<version>${jetty-version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit-version}</version>
+			<scope>test</scope>
+		</dependency>
+
+	</dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/OlingoSpringServlet.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/OlingoSpringServlet.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/OlingoSpringServlet.java
new file mode 100644
index 0000000..8decc03
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/OlingoSpringServlet.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ext.spring;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class OlingoSpringServlet extends HttpServlet {
+
+	private ApplicationContext context;
+
+	private ODataHttpHandler httpHandler;
+
+	protected ODataHttpHandler getHttpHandler() throws ServletException {
+		Map<String, ODataHttpHandler> odatas = context
+				.getBeansOfType(ODataHttpHandler.class);
+		if (odatas.size() == 1) {
+			return odatas.values().iterator().next();
+		}
+
+		throw new ServletException(
+				"No OData HTTP handler can be found in the Spring container.");
+	}
+
+	protected ApplicationContext initializeApplicationContext(ServletConfig config)
+			throws ServletException {
+		WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(config
+				.getServletContext());
+
+		if (context==null) {
+			throw new ServletException(
+				"No Spring container is configured within the Web application.");
+		}
+		
+		return context;
+	}
+
+	@Override
+	public void init(ServletConfig config) throws ServletException {
+		super.init();
+
+		context = initializeApplicationContext(config);
+
+		httpHandler = getHttpHandler();
+	}
+
+	@Override
+	protected void service(final HttpServletRequest req,
+			final HttpServletResponse resp) throws ServletException,
+			IOException {
+		System.err.println(">> service - begin - req = "+req.getRequestURL());
+		try {
+			httpHandler.process(req, resp);
+		} catch (RuntimeException e) {
+			// TODO: to be improved
+			throw new ServletException(e);
+		}
+		System.err.println(">> service - end");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmBeanDefinitionHelper.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmBeanDefinitionHelper.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmBeanDefinitionHelper.java
new file mode 100644
index 0000000..30f0e0c
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmBeanDefinitionHelper.java
@@ -0,0 +1,266 @@
+/*
+ * 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.ext.spring.config;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.ext.spring.edm.GenericEdmProvider;
+import org.apache.olingo.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.server.api.edm.provider.EntitySet;
+import org.apache.olingo.server.api.edm.provider.EntityType;
+import org.apache.olingo.server.api.edm.provider.Property;
+import org.apache.olingo.server.api.edm.provider.PropertyRef;
+import org.apache.olingo.server.api.edm.provider.Schema;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.ManagedList;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.util.xml.DomUtils;
+import org.w3c.dom.Element;
+
+public abstract class OlingoEdmBeanDefinitionHelper {
+	private static final Class<?> EDM_PROVIDER_CLASS = GenericEdmProvider.class;
+	private static final Class<?> SCHEMA_CLASS = Schema.class;
+	private static final Class<?> ENTITY_CONTAINER_CLASS = EntityContainer.class;
+	private static final Class<?> ENTITY_SET_CLASS = EntitySet.class;
+	private static final Class<?> ENTITY_TYPE_CLASS = EntityType.class;
+	private static final Class<?> PROPERTY_REF_CLASS = PropertyRef.class;
+	private static final Class<?> PROPERTY_CLASS = Property.class;
+	private static final Class<?> FULL_QUALIFIED_NAME_CLASS = FullQualifiedName.class;
+
+	private static final String SCHEMA_ELEMENT = "schema";
+	private static final String ENTITY_CONTAINER_ELEMENT = "entityContainer";
+	private static final String ENTITY_TYPE_ELEMENT = "entityType";
+	private static final String COMPLEX_TYPE_ELEMENT = "complexType";
+	private static final String ENTITY_SET_ELEMENT = "entitySet";
+	private static final String KEY_ELEMENT = "key";
+	private static final String PROPERTY_ELEMENT = "property";
+
+	private static final String NAME_ATTR = "name";
+	private static final String NAMESPACE_ATTR = "namespace";
+	private static final String TYPE_ATTR = "type";
+	private static final String PROPERTY_NAME_ATTR = "property-name";
+	private static final String ALIAS_ATTR = "alias";
+
+	private static final String SCHEMA_LIST_PROPERTY = "schemas";
+	private static final String ENTITY_TYPE_LIST_PROPERTY = "entityTypes";
+	private static final String COMPLEX_TYPE_LIST_PROPERTY = "complexTypes";
+	private static final String ENTITY_SET_LIST_PROPERTY = "entitySets";
+	private static final String ENTITY_CONTAINER_PROPERTY = "entityContainer";
+	private static final String NAME_PROPERTY = "name";
+	private static final String NAMESPACE_PROPERTY = "namespace";
+	private static final String ALIAS_PROPERTY = "alias";
+	private static final String TYPE_PROPERTY = "type";
+	private static final String KEY_LIST_PROPERTY = "key";
+	private static final String PROPERTY_LIST_PROPERTY = "properties";
+	private static final String PROPERTY_NAME_PROPERTY = "propertyName";
+
+	private static String elementAttribute(Element element, String name) {
+		String value = element.getAttribute(name);
+		return value.length() == 0 ? null : value;
+	}
+
+	private static BeanDefinitionBuilder createBeanDefinitionBuilder(
+			Class<?> beanClass) {
+		return BeanDefinitionBuilder.rootBeanDefinition(beanClass);
+	}
+
+	public static BeanDefinition parseEdmProvider(Element element,
+			ParserContext parserContext) {
+		BeanDefinitionBuilder configuration = createBeanDefinitionBuilder(EDM_PROVIDER_CLASS);
+
+		// Schemas
+		List<Element> schemaElements = DomUtils.getChildElementsByTagName(
+				element, SCHEMA_ELEMENT);
+		if (schemaElements.size() > 0) {
+			ManagedList<BeanDefinition> schemaList = new ManagedList<BeanDefinition>(
+					schemaElements.size());
+			for (Element schemaElement : schemaElements) {
+				BeanDefinition schema = parseSchema(schemaElement,
+						parserContext);
+				schemaList.add(schema);
+			}
+			configuration.addPropertyValue(SCHEMA_LIST_PROPERTY, schemaList);
+		}
+
+		return configuration.getBeanDefinition();
+	}
+
+	private static BeanDefinition parseSchema(Element element,
+			ParserContext parserContext) {
+		BeanDefinitionBuilder schema = createBeanDefinitionBuilder(SCHEMA_CLASS);
+
+		String namespace = elementAttribute(element, NAMESPACE_ATTR);
+		schema.addPropertyValue(NAMESPACE_PROPERTY, namespace);
+		String alias = elementAttribute(element, ALIAS_ATTR);
+		if (alias != null && !alias.isEmpty()) {
+			schema.addPropertyValue(ALIAS_PROPERTY, alias);
+		}
+
+		// Entity container
+		List<Element> entityContainerElements = DomUtils
+				.getChildElementsByTagName(element, ENTITY_CONTAINER_ELEMENT);
+		if (entityContainerElements.size() == 1) {
+			Element entityContainerElement = entityContainerElements.get(0);
+			BeanDefinition entityContainer = parseEntityContainer(
+					entityContainerElement, namespace, parserContext);
+			schema.addPropertyValue(ENTITY_CONTAINER_PROPERTY, entityContainer);
+		}
+
+		// Entity types
+		List<Element> entityTypeElements = DomUtils.getChildElementsByTagName(
+				element, ENTITY_TYPE_ELEMENT);
+		if (entityTypeElements.size() > 0) {
+			List<BeanDefinition> entityTypeList = new ManagedList<BeanDefinition>(
+					entityTypeElements.size());
+			for (Element entityTypeElement : entityTypeElements) {
+				BeanDefinition entityType = parseEntityType(entityTypeElement,
+						parserContext);
+				entityTypeList.add(entityType);
+			}
+			schema.addPropertyValue(ENTITY_TYPE_LIST_PROPERTY, entityTypeList);
+		}
+
+		// Complex types
+		List<Element> complexTypeElements = DomUtils.getChildElementsByTagName(
+				element, COMPLEX_TYPE_ELEMENT);
+		if (complexTypeElements.size() > 0) {
+			ManagedList<BeanDefinition> complexTypeList = new ManagedList<BeanDefinition>(
+					complexTypeElements.size());
+			for (Element complexTypeElement : complexTypeElements) {
+				BeanDefinition complexType = parseComplexType(
+						complexTypeElement, parserContext);
+				complexTypeList.add(complexType);
+			}
+			schema.addPropertyValue(COMPLEX_TYPE_LIST_PROPERTY, complexTypeList);
+		}
+
+		return schema.getBeanDefinition();
+	}
+
+	private static BeanDefinition parseEntityContainer(Element element,
+			String namespace, ParserContext parserContext) {
+		BeanDefinitionBuilder entityContainer = createBeanDefinitionBuilder(ENTITY_CONTAINER_CLASS);
+
+		// Name
+		entityContainer.addPropertyValue(NAME_PROPERTY, namespace
+				+ "EntityContainer");
+
+		// Entity sets
+		List<Element> entitySetElements = DomUtils.getChildElementsByTagName(
+				element, ENTITY_SET_ELEMENT);
+		if (entitySetElements.size() > 0) {
+			ManagedList<BeanDefinition> entitySetList = new ManagedList<BeanDefinition>(
+					entitySetElements.size());
+			for (Element entitySetElement : entitySetElements) {
+				BeanDefinition entitySet = parseEntitySet(entitySetElement,
+						namespace, parserContext);
+				entitySetList.add(entitySet);
+			}
+			entityContainer.addPropertyValue(ENTITY_SET_LIST_PROPERTY,
+					entitySetList);
+		}
+
+		return entityContainer.getBeanDefinition();
+	}
+
+	private static BeanDefinition parseEntitySet(Element element,
+			String namespace, ParserContext parserContext) {
+		BeanDefinitionBuilder entitySet = createBeanDefinitionBuilder(ENTITY_SET_CLASS);
+
+		String name = elementAttribute(element, NAME_ATTR);
+		String type = elementAttribute(element, TYPE_ATTR);
+		entitySet.addPropertyValue(NAME_PROPERTY, name);
+
+		BeanDefinitionBuilder fqn = createBeanDefinitionBuilder(FULL_QUALIFIED_NAME_CLASS);
+		fqn.addConstructorArgValue(namespace);
+		fqn.addConstructorArgValue(type);
+
+		entitySet.addPropertyValue(TYPE_PROPERTY, fqn.getBeanDefinition());
+
+		return entitySet.getBeanDefinition();
+	}
+
+	private static BeanDefinition parseEntityType(Element element,
+			ParserContext parserContext) {
+		BeanDefinitionBuilder entityType = createBeanDefinitionBuilder(ENTITY_TYPE_CLASS);
+
+		String propertyName = elementAttribute(element, NAME_ATTR);
+		entityType.addPropertyValue(NAME_PROPERTY, propertyName);
+
+		// Key
+		List<Element> keyElements = DomUtils.getChildElementsByTagName(element,
+				KEY_ELEMENT);
+		if (keyElements.size() > 0) {
+			ManagedList<BeanDefinition> keyList = new ManagedList<BeanDefinition>(
+					keyElements.size());
+			for (Element keyElement : keyElements) {
+				BeanDefinition key = parseKey(keyElement, parserContext);
+				keyList.add(key);
+			}
+			entityType.addPropertyValue(KEY_LIST_PROPERTY, keyList);
+		}
+
+		// Properties
+		List<Element> propertyElements = DomUtils.getChildElementsByTagName(
+				element, PROPERTY_ELEMENT);
+		if (propertyElements.size() > 0) {
+			ManagedList<BeanDefinition> entitySetList = new ManagedList<BeanDefinition>(
+					propertyElements.size());
+			for (Element propertyElement : propertyElements) {
+				BeanDefinition property = parseProperty(propertyElement,
+						parserContext);
+				entitySetList.add(property);
+			}
+			entityType.addPropertyValue(PROPERTY_LIST_PROPERTY, entitySetList);
+		}
+
+		return entityType.getBeanDefinition();
+	}
+
+	private static BeanDefinition parseKey(Element element,
+			ParserContext parserContext) {
+		BeanDefinitionBuilder property = createBeanDefinitionBuilder(PROPERTY_REF_CLASS);
+
+		String propertyName = elementAttribute(element, PROPERTY_NAME_ATTR);
+		property.addPropertyValue(PROPERTY_NAME_PROPERTY, propertyName);
+
+		return property.getBeanDefinition();
+	}
+
+	private static BeanDefinition parseProperty(Element element,
+			ParserContext parserContext) {
+		BeanDefinitionBuilder property = createBeanDefinitionBuilder(PROPERTY_CLASS);
+
+		String name = elementAttribute(element, NAME_ATTR);
+		String type = elementAttribute(element, TYPE_ATTR);
+		property.addPropertyValue(NAME_PROPERTY, name);
+		property.addPropertyValue(TYPE_PROPERTY, type);
+
+		return property.getBeanDefinition();
+	}
+
+	private static BeanDefinition parseComplexType(Element complexTypeElement,
+			ParserContext parserContext) {
+		// TODO to be implemented
+		return null;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmProviderBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmProviderBeanDefinitionParser.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmProviderBeanDefinitionParser.java
new file mode 100644
index 0000000..b64ebd0
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoEdmProviderBeanDefinitionParser.java
@@ -0,0 +1,36 @@
+/*
+ * 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.ext.spring.config;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+public class OlingoEdmProviderBeanDefinitionParser extends AbstractBeanDefinitionParser {
+
+	@Override
+	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
+		BeanDefinition configuration = OlingoEdmBeanDefinitionHelper.parseEdmProvider(element, parserContext);
+		return (AbstractBeanDefinition) configuration;
+	}
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHandlerBeanDefinitionHelper.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHandlerBeanDefinitionHelper.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHandlerBeanDefinitionHelper.java
new file mode 100644
index 0000000..129c55d
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHandlerBeanDefinitionHelper.java
@@ -0,0 +1,158 @@
+/*
+ * 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.ext.spring.config;
+
+import java.util.List;
+
+import org.apache.olingo.ext.spring.factory.EdmxReferenceFactoryBean;
+import org.apache.olingo.ext.spring.factory.ODataFactoryBean;
+import org.apache.olingo.ext.spring.factory.ODataHttpHandlerFactoryBean;
+import org.apache.olingo.ext.spring.factory.ServiceMetadataFactoryBean;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.ManagedList;
+import org.springframework.beans.factory.support.ManagedMap;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.util.xml.DomUtils;
+import org.w3c.dom.Element;
+
+public abstract class OlingoHandlerBeanDefinitionHelper {
+
+	private static final Class<?> ODATA_FACTORY_BEAN_CLASS = ODataFactoryBean.class;
+	private static final Class<?> HTTP_HANDLER_FACTORY_BEAN_CLASS = ODataHttpHandlerFactoryBean.class;
+	private static final Class<?> SERVICE_METADATA_FACTORY_BEAN_CLASS = ServiceMetadataFactoryBean.class;
+	private static final Class<?> EDMX_REFERENCE_FACTORY_BEAN = EdmxReferenceFactoryBean.class;
+
+	private static final String REFERENCE_ELEMENT = "reference";
+	private static final String PROCESSOR_ELEMENT = "processor";
+	private static final String INCLUDE_ELEMENT = "include";
+
+	private static final String EDM_PROVIDER_ATTR = "edm-provider";
+	private static final String REF_ATTR = "ref";
+	private static final String URI_ATTR = "uri";
+	private static final String KEY_ATTR = "key";
+	private static final String VALUE_ATTR = "value";
+
+	private static final String ODATA_PROPERTY = "odata";
+	private static final String SERVICE_METADATA_PROPERTY = "serviceMetadata";
+	private static final String REFERENCES_LIST_PROPERTY = "references";
+	private static final String PROCESSORS_LIST_PROPERTY = "processors";
+	private static final String EDM_PROVIDER_PROPERTY = "edmProvider";
+	private static final String URI_PROPERTY = "uri";
+	private static final String INCLUDES_PROPERTY = "includes";
+
+	private static String elementAttribute(Element element, String name) {
+		String value = element.getAttribute(name);
+		return value.length() == 0 ? null : value;
+	}
+
+	private static BeanDefinitionBuilder createBeanDefinitionBuilder(
+			Class<?> beanClass) {
+		return BeanDefinitionBuilder.rootBeanDefinition(beanClass);
+	}
+
+	public static BeanDefinition parseHttpHandler(Element element,
+			ParserContext parserContext) {
+		BeanDefinitionBuilder httpHandler = createBeanDefinitionBuilder(HTTP_HANDLER_FACTORY_BEAN_CLASS);
+
+		// OData
+		BeanDefinitionBuilder odataBuilder = createBeanDefinitionBuilder(ODATA_FACTORY_BEAN_CLASS);
+		BeanDefinition odata = odataBuilder.getBeanDefinition();
+
+		httpHandler.addPropertyValue(ODATA_PROPERTY, odata);
+
+		// ServiceMetadata
+		BeanDefinitionBuilder serviceMetadata = createBeanDefinitionBuilder(SERVICE_METADATA_FACTORY_BEAN_CLASS);
+		serviceMetadata.addPropertyValue(ODATA_PROPERTY, odata);
+
+		String edmProviderRef = elementAttribute(element, EDM_PROVIDER_ATTR);
+		serviceMetadata.addPropertyValue(EDM_PROVIDER_PROPERTY,
+				new RuntimeBeanReference(edmProviderRef));
+
+		// References
+		List<Element> referenceElements = DomUtils.getChildElementsByTagName(
+				element, REFERENCE_ELEMENT);
+		if (referenceElements.size() > 0) {
+			ManagedList<BeanDefinition> referenceList = new ManagedList<BeanDefinition>(
+					referenceElements.size());
+			for (Element referenceElement : referenceElements) {
+				BeanDefinition reference = parseReference(referenceElement,
+						parserContext);
+				referenceList.add(reference);
+			}
+			serviceMetadata.addPropertyValue(REFERENCES_LIST_PROPERTY,
+					referenceList);
+		}
+
+		httpHandler.addPropertyValue(SERVICE_METADATA_PROPERTY,
+				serviceMetadata.getBeanDefinition());
+
+		// Processors
+		List<Element> processorElements = DomUtils.getChildElementsByTagName(
+				element, PROCESSOR_ELEMENT);
+		if (processorElements.size() > 0) {
+			ManagedList<RuntimeBeanReference> processorList = new ManagedList<RuntimeBeanReference>(
+					processorElements.size());
+			for (Element processorElement : processorElements) {
+				RuntimeBeanReference processorRef = parseProcessor(
+						processorElement, parserContext);
+				processorList.add(processorRef);
+			}
+			httpHandler.addPropertyValue(PROCESSORS_LIST_PROPERTY,
+					processorList);
+		}
+
+		AbstractBeanDefinition configurationDef = httpHandler
+				.getBeanDefinition();
+		return configurationDef;
+	}
+
+	private static BeanDefinition parseReference(Element referenceElement,
+			ParserContext parserContext) {
+		BeanDefinitionBuilder reference = createBeanDefinitionBuilder(EDMX_REFERENCE_FACTORY_BEAN);
+
+		String uri = elementAttribute(referenceElement, URI_ATTR);
+		reference.addPropertyValue(URI_PROPERTY, uri);
+
+		// Processors
+		List<Element> includeElements = DomUtils.getChildElementsByTagName(
+				referenceElement, INCLUDE_ELEMENT);
+		if (includeElements.size() > 0) {
+			ManagedMap<String, String> includeMap = new ManagedMap<String, String>(
+					includeElements.size());
+			for (Element includeElement : includeElements) {
+				String key = elementAttribute(includeElement, KEY_ATTR);
+				String value = elementAttribute(includeElement, VALUE_ATTR);
+				includeMap.put(key, value);
+			}
+			reference.addPropertyValue(INCLUDES_PROPERTY, includeMap);
+		}
+
+		return reference.getBeanDefinition();
+	}
+
+	private static RuntimeBeanReference parseProcessor(
+			Element processorElement, ParserContext parserContext) {
+		String ref = elementAttribute(processorElement, REF_ATTR);
+		return new RuntimeBeanReference(ref);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHttpHandlerBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHttpHandlerBeanDefinitionParser.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHttpHandlerBeanDefinitionParser.java
new file mode 100644
index 0000000..ecd3fa2
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoHttpHandlerBeanDefinitionParser.java
@@ -0,0 +1,36 @@
+/*
+ * 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.ext.spring.config;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+public class OlingoHttpHandlerBeanDefinitionParser extends AbstractBeanDefinitionParser {
+
+	@Override
+	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
+		BeanDefinition configuration = OlingoHandlerBeanDefinitionHelper.parseHttpHandler(element, parserContext);
+		return (AbstractBeanDefinition) configuration;
+	}
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoNamespaceHandler.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoNamespaceHandler.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoNamespaceHandler.java
new file mode 100644
index 0000000..2dc64fa
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/config/OlingoNamespaceHandler.java
@@ -0,0 +1,61 @@
+/*
+ * 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.ext.spring.config;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+/**
+ * Dedicated Spring namespace handler for Olingo. This namespace is directly
+ * usable within a Spring application context.
+ * 
+ * This namespace can be configured in Spring XML configuration files using
+ * standard mechanisms of XML namespace, as following:
+ * 
+ * &lt;beans xmlns="http://www.springframework.org/schema/beans"
+ *     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ *     xmlns:olingo="http://olingo.apache.org/schema/olingo/spring-olingo"
+ *     xsi:schemaLocation="http://www.springframework.org/schema/beans
+ *         http://www.springframework.org/schema/beans/spring-beans.xsd
+ *       http://olingo.apache.org/schema/olingo/spring-olingo
+ *         http://olingo.apache.org/schema/olingo/spring-olingo.xsd"&gt;
+ *   (...)
+ * &lt;/beans&gt;
+ * 
+ * @author Thierry Templier
+ */
+public class OlingoNamespaceHandler extends NamespaceHandlerSupport {
+
+	public static final String EDM_PROVIDER_ELEMENT = "edm-provider";
+
+	public static final String HTTP_HANDLER_ELEMENT = "http-handler";
+
+	/**
+	 * Registers bean definition parsers for the olingo namespace.
+	 * 
+	 * @see OlingoEdmProviderBeanDefinitionParser
+	 * @see OlingoHttpHandlerBeanDefinitionParser
+	 */
+	public void init() {
+		registerBeanDefinitionParser(EDM_PROVIDER_ELEMENT,
+				new OlingoEdmProviderBeanDefinitionParser());
+		registerBeanDefinitionParser(HTTP_HANDLER_ELEMENT,
+				new OlingoHttpHandlerBeanDefinitionParser());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/editor/FullQualifiedNameEditor.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/editor/FullQualifiedNameEditor.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/editor/FullQualifiedNameEditor.java
new file mode 100644
index 0000000..b617eac
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/editor/FullQualifiedNameEditor.java
@@ -0,0 +1,34 @@
+/*
+ * 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.ext.spring.editor;
+
+import java.beans.PropertyEditorSupport;
+
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public class FullQualifiedNameEditor extends PropertyEditorSupport {
+	public void setAsText(String text) {
+		String[] tokens = text.split("\\.");
+		if (tokens.length==2) {
+			setValue(new FullQualifiedName(tokens[0], tokens[1]));
+		} else {
+			setValue(new FullQualifiedName(text));
+		}
+    }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/edm/GenericEdmProvider.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/edm/GenericEdmProvider.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/edm/GenericEdmProvider.java
new file mode 100644
index 0000000..6cdc02e
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/edm/GenericEdmProvider.java
@@ -0,0 +1,254 @@
+/*
+ * 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.ext.spring.edm;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.server.api.edm.provider.Action;
+import org.apache.olingo.server.api.edm.provider.ActionImport;
+import org.apache.olingo.server.api.edm.provider.AliasInfo;
+import org.apache.olingo.server.api.edm.provider.ComplexType;
+import org.apache.olingo.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.server.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.server.api.edm.provider.EntitySet;
+import org.apache.olingo.server.api.edm.provider.EntityType;
+import org.apache.olingo.server.api.edm.provider.EnumType;
+import org.apache.olingo.server.api.edm.provider.Function;
+import org.apache.olingo.server.api.edm.provider.FunctionImport;
+import org.apache.olingo.server.api.edm.provider.Schema;
+import org.apache.olingo.server.api.edm.provider.Singleton;
+import org.apache.olingo.server.api.edm.provider.Term;
+import org.apache.olingo.server.api.edm.provider.TypeDefinition;
+
+public class GenericEdmProvider extends EdmProvider {
+
+	private String containerName = "default";
+
+	private List<Schema> schemas = new ArrayList<>();
+
+	// OData
+
+	@Override
+	public List<Schema> getSchemas() throws ODataException {
+		return schemas;
+	}
+
+	@Override
+	public EntityContainer getEntityContainer() throws ODataException {
+		EntityContainer container = new EntityContainer();
+		container.setName(containerName);
+
+		// EntitySets
+		List<EntitySet> entitySets = new ArrayList<EntitySet>();
+		container.setEntitySets(entitySets);
+
+		// Load entity sets per index
+		for (Schema schema : schemas) {
+
+			if (schema.getEntityContainer() != null
+					&& schema.getEntityContainer().getEntitySets() != null) {
+				for (EntitySet schemaEntitySet : schema.getEntityContainer()
+						.getEntitySets()) {
+					EntitySet entitySet = new EntitySet().setName(
+							schemaEntitySet.getName()).setType(
+							new FullQualifiedName(schemaEntitySet.getType()
+									.getNamespace(), schemaEntitySet.getType()
+									.getName()));
+					entitySets.add(entitySet);
+				}
+			}
+		}
+
+		return container;
+	}
+
+	private Schema findSchema(String namespace) {
+		for (Schema schema : schemas) {
+			if (schema.getNamespace().equals(namespace)) {
+				return schema;
+			}
+		}
+
+		return null;
+	}
+
+	private EntityType findEntityType(Schema schema, String entityTypeName) {
+		for (EntityType entityType : schema.getEntityTypes()) {
+			if (entityType.getName().equals(entityTypeName)) {
+				return entityType;
+			}
+		}
+
+		return null;
+	}
+
+	@Override
+	public EntityType getEntityType(FullQualifiedName entityTypeName)
+			throws ODataException {
+		Schema schema = findSchema(entityTypeName.getNamespace());
+		return findEntityType(schema, entityTypeName.getName());
+	}
+
+	private EnumType findEnumType(Schema schema, String enumTypeName) {
+		for (EnumType enumType : schema.getEnumTypes()) {
+			if (enumType.getName().equals(enumTypeName)) {
+				return enumType;
+			}
+		}
+
+		return null;
+	}
+
+	@Override
+	public EnumType getEnumType(FullQualifiedName enumTypeName)
+			throws ODataException {
+		Schema schema = findSchema(enumTypeName.getNamespace());
+		return findEnumType(schema, enumTypeName.getName());
+	}
+
+	@Override
+	public TypeDefinition getTypeDefinition(FullQualifiedName typeDefinitionName)
+			throws ODataException {
+		System.out.println(">> getTypeDefinition");
+		// TODO Auto-generated method stub
+		return super.getTypeDefinition(typeDefinitionName);
+	}
+
+	private ComplexType findComplexType(Schema schema, String complexTypeName) {
+		for (ComplexType complexType : schema.getComplexTypes()) {
+			if (complexType.getName().equals(complexTypeName)) {
+				return complexType;
+			}
+		}
+
+		return null;
+	}
+
+	@Override
+	public ComplexType getComplexType(FullQualifiedName complexTypeName)
+			throws ODataException {
+		Schema schema = findSchema(complexTypeName.getNamespace());
+		return findComplexType(schema, complexTypeName.getName());
+	}
+
+	@Override
+	public List<Action> getActions(FullQualifiedName actionName)
+			throws ODataException {
+		System.out.println(">> getActions");
+		// TODO Auto-generated method stub
+		return super.getActions(actionName);
+	}
+
+	@Override
+	public List<Function> getFunctions(FullQualifiedName functionName)
+			throws ODataException {
+		System.out.println(">> getFunctions");
+		// TODO Auto-generated method stub
+		return super.getFunctions(functionName);
+	}
+
+	@Override
+	public Term getTerm(FullQualifiedName termName) throws ODataException {
+		System.out.println(">> getTerm");
+		// TODO Auto-generated method stub
+		return super.getTerm(termName);
+	}
+
+	private EntitySet findEntitySetInSchemas(String entitySetName)
+			throws ODataException {
+		List<Schema> schemas = getSchemas();
+		for (Schema schema : schemas) {
+			EntityContainer entityContainer = schema.getEntityContainer();
+			List<EntitySet> entitySets = entityContainer.getEntitySets();
+			for (EntitySet entitySet : entitySets) {
+				if (entitySet.getName().equals(entitySetName)) {
+					return entitySet;
+				}
+			}
+		}
+		return null;
+	}
+
+	@Override
+	public EntitySet getEntitySet(FullQualifiedName entityContainer,
+			String entitySetName) throws ODataException {
+		return findEntitySetInSchemas(entitySetName);
+	}
+
+	@Override
+	public Singleton getSingleton(FullQualifiedName entityContainer,
+			String singletonName) throws ODataException {
+		System.out.println(">> getSingleton");
+		// TODO Auto-generated method stub
+		return super.getSingleton(entityContainer, singletonName);
+	}
+
+	@Override
+	public ActionImport getActionImport(FullQualifiedName entityContainer,
+			String actionImportName) throws ODataException {
+		System.out.println(">> getActionImport");
+		// TODO Auto-generated method stub
+		return super.getActionImport(entityContainer, actionImportName);
+	}
+
+	@Override
+	public FunctionImport getFunctionImport(FullQualifiedName entityContainer,
+			String functionImportName) throws ODataException {
+		System.out.println(">> getFunctionImport");
+		// TODO Auto-generated method stub
+		return super.getFunctionImport(entityContainer, functionImportName);
+	}
+
+	@Override
+	public EntityContainerInfo getEntityContainerInfo(
+			FullQualifiedName entityContainerName) throws ODataException {
+		EntityContainer container = getEntityContainer();
+		FullQualifiedName fqName = new FullQualifiedName(container.getName(),
+				container.getName());
+		EntityContainerInfo info = new EntityContainerInfo();
+		info.setContainerName(fqName);
+		return info;
+	}
+
+	@Override
+	public List<AliasInfo> getAliasInfos() throws ODataException {
+		System.out.println(">> getAliasInfos");
+		// TODO Auto-generated method stub
+		return super.getAliasInfos();
+	}
+
+	// DI
+
+	public void setSchemas(List<Schema> schemas) {
+		this.schemas = schemas;
+	}
+
+	public String getContainerName() {
+		return containerName;
+	}
+
+	public void setContainerName(String containerName) {
+		this.containerName = containerName;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/EdmxReferenceFactoryBean.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/EdmxReferenceFactoryBean.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/EdmxReferenceFactoryBean.java
new file mode 100644
index 0000000..49684e4
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/EdmxReferenceFactoryBean.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.ext.spring.factory;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.api.edmx.EdmxReferenceInclude;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+
+public class EdmxReferenceFactoryBean implements FactoryBean<EdmxReference>,
+		InitializingBean {
+	private String uri;
+	private Map<String, String> includes;
+
+	@Override
+	public void afterPropertiesSet() throws Exception {
+		if (uri == null) {
+			throw new IllegalArgumentException("The property uri is required.");
+		}
+	}
+
+	@Override
+	public EdmxReference getObject() throws Exception {
+		EdmxReference reference = new EdmxReference(URI.create(uri));
+		if (includes != null) {
+			for (Entry<String, String> include : includes.entrySet()) {
+				reference.addInclude(new EdmxReferenceInclude(include.getKey(),
+						include.getValue()));
+			}
+		}
+		return reference;
+	}
+
+	@Override
+	public Class<?> getObjectType() {
+		return EdmxReference.class;
+	}
+
+	@Override
+	public boolean isSingleton() {
+		return true;
+	}
+
+	public String getUri() {
+		return uri;
+	}
+
+	public void setUri(String uri) {
+		this.uri = uri;
+	}
+
+	public Map<String, String> getIncludes() {
+		return includes;
+	}
+
+	public void setIncludes(Map<String, String> includes) {
+		this.includes = includes;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataFactoryBean.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataFactoryBean.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataFactoryBean.java
new file mode 100644
index 0000000..a310c7f
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataFactoryBean.java
@@ -0,0 +1,41 @@
+/*
+ * 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.ext.spring.factory;
+
+import org.apache.olingo.server.api.OData;
+import org.springframework.beans.factory.FactoryBean;
+
+public class ODataFactoryBean implements FactoryBean<OData> {
+
+	@Override
+	public OData getObject() throws Exception {
+		return OData.newInstance();
+	}
+
+	@Override
+	public Class<?> getObjectType() {
+		return OData.class;
+	}
+
+	@Override
+	public boolean isSingleton() {
+		return true;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataHttpHandlerFactoryBean.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataHttpHandlerFactoryBean.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataHttpHandlerFactoryBean.java
new file mode 100644
index 0000000..5456957
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ODataHttpHandlerFactoryBean.java
@@ -0,0 +1,94 @@
+/*
+ * 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.ext.spring.factory;
+
+import java.util.List;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.Processor;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+
+public class ODataHttpHandlerFactoryBean implements
+		FactoryBean<ODataHttpHandler>, InitializingBean {
+	private OData odata;
+	private ServiceMetadata serviceMetadata;
+	private List<Processor> processors;
+
+	@Override
+	public ODataHttpHandler getObject() throws Exception {
+		ODataHttpHandler handler = odata.createHandler(serviceMetadata);
+		if (processors != null) {
+			for (Processor processor : processors) {
+				handler.register(processor);
+			}
+		}
+		return handler;
+	}
+
+	@Override
+	public Class<?> getObjectType() {
+		return ODataHttpHandler.class;
+	}
+
+	@Override
+	public boolean isSingleton() {
+		return true;
+	}
+
+	@Override
+	public void afterPropertiesSet() throws Exception {
+		if (odata == null) {
+			throw new IllegalArgumentException(
+					"The property odata is required.");
+		}
+
+		if (serviceMetadata == null) {
+			throw new IllegalArgumentException(
+					"The property serviceMetadata is required.");
+		}
+	}
+
+	public OData getOdata() {
+		return odata;
+	}
+
+	public void setOdata(OData odata) {
+		this.odata = odata;
+	}
+
+	public ServiceMetadata getServiceMetadata() {
+		return serviceMetadata;
+	}
+
+	public void setServiceMetadata(ServiceMetadata serviceMetadata) {
+		this.serviceMetadata = serviceMetadata;
+	}
+
+	public List<Processor> getProcessors() {
+		return processors;
+	}
+
+	public void setProcessors(List<Processor> processors) {
+		this.processors = processors;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ServiceMetadataFactoryBean.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ServiceMetadataFactoryBean.java b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ServiceMetadataFactoryBean.java
new file mode 100644
index 0000000..f01bd93
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/java/org/apache/olingo/ext/spring/factory/ServiceMetadataFactoryBean.java
@@ -0,0 +1,92 @@
+/*
+ * 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.ext.spring.factory;
+
+import java.util.List;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+
+public class ServiceMetadataFactoryBean implements
+		FactoryBean<ServiceMetadata>, InitializingBean {
+	private OData odata;
+	private EdmProvider edmProvider;
+	private List<EdmxReference> references;
+
+	@Override
+	public void afterPropertiesSet() throws Exception {
+		if (odata == null) {
+			throw new IllegalArgumentException(
+					"The property odata is required.");
+		}
+
+		if (edmProvider == null) {
+			throw new IllegalArgumentException(
+					"The property edmProvider is required.");
+		}
+
+		if (references == null) {
+			throw new IllegalArgumentException(
+					"The property references is required.");
+		}
+	}
+
+	@Override
+	public ServiceMetadata getObject() throws Exception {
+		return odata.createServiceMetadata(edmProvider, references);
+	}
+
+	@Override
+	public Class<?> getObjectType() {
+		return ServiceMetadata.class;
+	}
+
+	@Override
+	public boolean isSingleton() {
+		return true;
+	}
+
+	public OData getOdata() {
+		return odata;
+	}
+
+	public void setOdata(OData odata) {
+		this.odata = odata;
+	}
+
+	public EdmProvider getEdmProvider() {
+		return edmProvider;
+	}
+
+	public void setEdmProvider(EdmProvider edmProvider) {
+		this.edmProvider = edmProvider;
+	}
+
+	public List<EdmxReference> getReferences() {
+		return references;
+	}
+
+	public void setReferences(List<EdmxReference> references) {
+		this.references = references;
+	}
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/resources/META-INF/spring.handlers
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/resources/META-INF/spring.handlers b/ext/olingo-ext-spring/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000..13d1260
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1 @@
+http\://olingo.apache.org/schema/olingo/spring-olingo=org.apache.olingo.ext.spring.config.OlingoNamespaceHandler
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/resources/META-INF/spring.schemas
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/resources/META-INF/spring.schemas b/ext/olingo-ext-spring/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000..1eb42b2
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1 @@
+http\://olingo.apache.org/schema/olingo/spring-olingo.xsd=org/apache/olingo/ext/spring/config/spring-olingo.xsd
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/main/resources/org/apache/olingo/ext/spring/config/spring-olingo.xsd
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/main/resources/org/apache/olingo/ext/spring/config/spring-olingo.xsd b/ext/olingo-ext-spring/src/main/resources/org/apache/olingo/ext/spring/config/spring-olingo.xsd
new file mode 100644
index 0000000..bff82f0
--- /dev/null
+++ b/ext/olingo-ext-spring/src/main/resources/org/apache/olingo/ext/spring/config/spring-olingo.xsd
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+    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.
+
+-->
+<xsd:schema xmlns="http://olingo.apache.org/schema/olingo/spring-olingo"
+	xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	targetNamespace="http://olingo.apache.org/schema/olingo/spring-olingo"
+	elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+	<xsd:import namespace="http://www.springframework.org/schema/beans"
+		schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" />
+
+	<!-- Edm provider -->
+
+	<xsd:attributeGroup name="configurationAttributes">
+		<xsd:attribute name="id" type="xsd:string" use="required" />
+	</xsd:attributeGroup>
+	
+	<xsd:element name="edm-provider" type="edmProviderBeanType">
+	</xsd:element>
+
+	<xsd:complexType name="edmProviderBeanType">
+		<xsd:sequence>
+			<xsd:element name="schema" maxOccurs="unbounded" type="schemaBeanType"/>
+		</xsd:sequence>
+		<xsd:attribute name="id" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="schemaBeanType">
+		<xsd:sequence>
+			<xsd:element name="entityContainer" minOccurs="1" maxOccurs="1" type="entityContainerBeanType"/>
+			<xsd:element name="entityType" minOccurs="0" maxOccurs="unbounded" type="entityTypeBeanType"/>
+			<xsd:element name="complexType" minOccurs="0" maxOccurs="unbounded" type="complexTypeBeanType"/>
+		</xsd:sequence>
+		<xsd:attribute name="namespace" type="xsd:string" use="required"/>
+		<xsd:attribute name="alias" type="xsd:string"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="entityContainerBeanType">
+		<xsd:sequence>
+			<xsd:element name="entitySet" minOccurs="0" maxOccurs="unbounded" type="entitySetBeanType"/>
+		</xsd:sequence>
+	</xsd:complexType>
+
+	<xsd:complexType name="entitySetBeanType">
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="type" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="entityTypeBeanType">
+		<xsd:sequence>
+			<xsd:element name="key" minOccurs="1" maxOccurs="unbounded" type="entityTypeKeyBeanType"/>
+			<xsd:element name="property" minOccurs="1" maxOccurs="unbounded" type="entityTypePropertyBeanType"/>
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="entityTypeKeyBeanType">
+		<xsd:attribute name="property-name" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="entityTypePropertyBeanType">
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="type" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="complexTypeBeanType">
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<!-- Http handler -->
+
+	<xsd:element name="http-handler" type="httpHandlerBeanType">
+	</xsd:element>
+
+	<xsd:complexType name="httpHandlerBeanType">
+		<xsd:sequence>
+			<xsd:element name="reference" minOccurs="1" maxOccurs="unbounded" type="referenceBeanType"/>
+			<xsd:element name="processor" maxOccurs="unbounded" type="processorBeanType"/>
+		</xsd:sequence>
+		<xsd:attribute name="id" type="xsd:string" use="required"/>
+		<xsd:attribute name="edm-provider" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="referenceBeanType">
+		<xsd:sequence>
+			<xsd:element name="include" maxOccurs="unbounded" type="referenceIncludeBeanType"/>
+		</xsd:sequence>
+		<xsd:attribute name="uri" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="referenceIncludeBeanType">
+		<xsd:attribute name="key" type="xsd:string" use="required"/>
+		<xsd:attribute name="value" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="processorBeanType">
+		<xsd:attribute name="ref" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoEdmProviderWithoutNamespaceTest.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoEdmProviderWithoutNamespaceTest.java b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoEdmProviderWithoutNamespaceTest.java
new file mode 100644
index 0000000..fe505e0
--- /dev/null
+++ b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoEdmProviderWithoutNamespaceTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.ext.spring.config;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.server.api.edm.provider.EntityType;
+import org.apache.olingo.server.api.edm.provider.Property;
+import org.apache.olingo.server.api.edm.provider.PropertyRef;
+import org.apache.olingo.server.api.edm.provider.Schema;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringOlingoEdmProviderWithoutNamespaceTest {
+	@Test
+	public void testLaunchSpring() {
+		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+				"/applicationContext-edm-provider-beans.xml");
+		try {
+			EdmProvider edmProvider = (EdmProvider) context
+					.getBean("edmProvider");
+			Assert.assertNotNull(edmProvider);
+			try {
+				EntityContainer entityContainer = edmProvider.getEntityContainer();
+				Assert.assertNotNull(entityContainer);
+				Assert.assertNotNull(entityContainer.getEntitySets());
+				Assert.assertEquals(1, entityContainer.getEntitySets().size());
+
+				List<Schema> schemas = edmProvider.getSchemas();
+				Assert.assertNotNull(schemas);
+				Assert.assertEquals(1, schemas.size());
+
+				Schema schema = schemas.get(0);
+				Assert.assertEquals("test", schema.getNamespace());
+				
+				List<EntityType> entityTypes = schema.getEntityTypes();
+				Assert.assertNotNull(entityTypes);
+				Assert.assertEquals(1, entityTypes.size());
+				
+				EntityType entityType = entityTypes.get(0);
+				Assert.assertEquals("sources1", entityType.getName());
+				
+				
+				List<Property> properties = entityType.getProperties();
+				Assert.assertNotNull(properties);
+				Assert.assertEquals(1, properties.size());
+				Property property0 = properties.get(0);
+				Assert.assertEquals("field1", property0.getName());
+				Assert.assertEquals("Edm.String", property0.getType().toString());
+				
+				List<PropertyRef> key = entityType.getKey();
+				Assert.assertNotNull(key);
+				Assert.assertEquals(1, key.size());
+				PropertyRef key0 = key.get(0);
+				Assert.assertEquals("field1", key0.getPropertyName());
+			} catch (ODataException ex) {
+				ex.printStackTrace();
+			}
+		} finally {
+			if (context != null) {
+				context.close();
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoHttpHandlerWithoutNamespaceTest.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoHttpHandlerWithoutNamespaceTest.java b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoHttpHandlerWithoutNamespaceTest.java
new file mode 100644
index 0000000..5e402a6
--- /dev/null
+++ b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoHttpHandlerWithoutNamespaceTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.ext.spring.config;
+
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringOlingoHttpHandlerWithoutNamespaceTest {
+	@Test
+	public void testLaunchSpring() {
+		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+				"/applicationContext-http-handler-beans.xml");
+		try {
+			ODataHttpHandler httpHandler = (ODataHttpHandler) context
+					.getBean("httpHandler");
+			Assert.assertNotNull(httpHandler);
+		} finally {
+			if (context != null) {
+				context.close();
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceEdmProviderTest.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceEdmProviderTest.java b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceEdmProviderTest.java
new file mode 100644
index 0000000..184e546
--- /dev/null
+++ b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceEdmProviderTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.ext.spring.config;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.server.api.edm.provider.EntityType;
+import org.apache.olingo.server.api.edm.provider.Property;
+import org.apache.olingo.server.api.edm.provider.PropertyRef;
+import org.apache.olingo.server.api.edm.provider.Schema;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringOlingoNamespaceEdmProviderTest {
+	@Test
+	public void testLaunchSpring() {
+		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+				"/applicationContext-edm-provider-namespace.xml");
+		try {
+			EdmProvider edmProvider = (EdmProvider) context
+					.getBean("edmProvider");
+			Assert.assertNotNull(edmProvider);
+			try {
+				EntityContainer entityContainer = edmProvider.getEntityContainer();
+				Assert.assertNotNull(entityContainer);
+				Assert.assertNotNull(entityContainer.getEntitySets());
+				Assert.assertEquals(1, entityContainer.getEntitySets().size());
+				
+				List<Schema> schemas = edmProvider.getSchemas();
+				Assert.assertNotNull(schemas);
+				Assert.assertEquals(1, schemas.size());
+
+				Schema schema = schemas.get(0);
+				Assert.assertEquals("test", schema.getNamespace());
+				
+				List<EntityType> entityTypes = schema.getEntityTypes();
+				Assert.assertNotNull(entityTypes);
+				Assert.assertEquals(1, entityTypes.size());
+				
+				EntityType entityType = entityTypes.get(0);
+				Assert.assertEquals("sources1", entityType.getName());
+				
+				List<Property> properties = entityType.getProperties();
+				Assert.assertNotNull(properties);
+				Assert.assertEquals(6, properties.size());
+				// field #0
+				Property property0 = properties.get(0);
+				Assert.assertEquals("field1", property0.getName());
+				Assert.assertEquals("Edm.String", property0.getType().toString());
+				// field #1
+				Property property1 = properties.get(1);
+				Assert.assertEquals("field2", property1.getName());
+				Assert.assertEquals("Edm.Int32", property1.getType().toString());
+				// field #2
+				Property property2 = properties.get(2);
+				Assert.assertEquals("field3", property2.getName());
+				Assert.assertEquals("Edm.Int64", property2.getType().toString());
+				// field #3
+				Property property3 = properties.get(3);
+				Assert.assertEquals("field4", property3.getName());
+				Assert.assertEquals("Edm.Double", property3.getType().toString());
+				// field #4
+				Property property4 = properties.get(4);
+				Assert.assertEquals("field5", property4.getName());
+				Assert.assertEquals("Edm.Double", property4.getType().toString());
+				// field #5
+				Property property5 = properties.get(5);
+				Assert.assertEquals("field6", property5.getName());
+				Assert.assertEquals("Edm.Boolean", property5.getType().toString());
+				
+				List<PropertyRef> key = entityType.getKey();
+				Assert.assertNotNull(key);
+				Assert.assertEquals(1, key.size());
+				PropertyRef key0 = key.get(0);
+				Assert.assertEquals("field1", key0.getPropertyName());
+			} catch (ODataException ex) {
+				ex.printStackTrace();
+			}
+		} finally {
+			if (context != null) {
+				context.close();
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceHttpHandlerTest.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceHttpHandlerTest.java b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceHttpHandlerTest.java
new file mode 100644
index 0000000..00d4b4d
--- /dev/null
+++ b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/SpringOlingoNamespaceHttpHandlerTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.ext.spring.config;
+
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringOlingoNamespaceHttpHandlerTest {
+	@Test
+	public void testLaunchSpring() {
+		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+				"/applicationContext-http-handler-namespace.xml");
+		try {
+			ODataHttpHandler httpHandler = (ODataHttpHandler) context
+					.getBean("httpHandler");
+			Assert.assertNotNull(httpHandler);
+		} finally {
+			if (context != null) {
+				context.close();
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/TestProcessor.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/TestProcessor.java b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/TestProcessor.java
new file mode 100644
index 0000000..b60c45e
--- /dev/null
+++ b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/config/TestProcessor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.ext.spring.config;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.Processor;
+
+public class TestProcessor implements Processor {
+
+	@Override
+	public void init(OData arg0, ServiceMetadata arg1) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/OlingoSpringTestServlet.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/OlingoSpringTestServlet.java b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/OlingoSpringTestServlet.java
new file mode 100644
index 0000000..e0357b3
--- /dev/null
+++ b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/OlingoSpringTestServlet.java
@@ -0,0 +1,36 @@
+/*
+ * 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.ext.spring.integration;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import org.apache.olingo.ext.spring.OlingoSpringServlet;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class OlingoSpringTestServlet extends OlingoSpringServlet {
+
+	@Override
+	protected ApplicationContext initializeApplicationContext(ServletConfig config)
+			throws ServletException {
+		return new ClassPathXmlApplicationContext("/applicationContext-namespace.xml");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f4a1f434/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/SpringOlingoNamespaceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/SpringOlingoNamespaceIntegrationTest.java b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/SpringOlingoNamespaceIntegrationTest.java
new file mode 100644
index 0000000..c2e91f8
--- /dev/null
+++ b/ext/olingo-ext-spring/src/test/java/org/apache/olingo/ext/spring/integration/SpringOlingoNamespaceIntegrationTest.java
@@ -0,0 +1,153 @@
+/*
+ * 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.ext.spring.integration;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.servlet.http.HttpServlet;
+
+import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class SpringOlingoNamespaceIntegrationTest {
+	private static Server server;
+
+	private static void configureAndStartupEmbeddedWebServer(Class<? extends HttpServlet> odataServletClass) throws Exception {
+		server = startupEmbeddedWebServer();
+		ServletHandler handler = (ServletHandler) server.getHandler();
+        handler.addServletWithMapping(odataServletClass, "/odata.svc/*");
+        server.start();
+	}
+
+	private static Server startupEmbeddedWebServer() throws Exception {
+		Server server = new Server(8080);
+		ServletHandler handler = new ServletHandler();
+        server.setHandler(handler);
+		//server.start();
+        
+		return server;
+	}
+	
+	private static void shutdownEmbeddedWebServer() throws Exception {
+		if (server!=null) {
+			server.stop();
+	        server.join();
+	        server.destroy();
+		}
+	}
+
+	@BeforeClass
+	public static void setUp() throws Exception {
+		configureAndStartupEmbeddedWebServer(OlingoSpringTestServlet.class);
+	}
+	
+	@AfterClass
+	public static void tearDown() throws Exception {
+		shutdownEmbeddedWebServer();
+	}
+
+	//@Test
+	public void testServiceDocument() {
+		String serviceRoot = "http://localhost:8080/odata.svc";
+
+		ODataClient client = ODataClientFactory.getV4();
+		ODataServiceDocumentRequest req =
+	        client.getRetrieveRequestFactory().getServiceDocumentRequest(serviceRoot);
+		req.setContentType("application/json;odata.metadata=minimal");
+		req.setAccept("application/json;odata.metadata=minimal");
+		ODataRetrieveResponse<ODataServiceDocument> res = req.execute();
+		
+		ODataServiceDocument serviceDocument = res.getBody();
+
+		Collection<String> entitySetNames = serviceDocument.getEntitySetNames();
+		Assert.assertEquals(1, entitySetNames.size());
+		String entitySetName = entitySetNames.iterator().next();
+		Assert.assertEquals("sources1", entitySetName);
+
+		Map<String,URI> entitySets = serviceDocument.getEntitySets();
+		Assert.assertEquals(1, entitySets.size());
+		Entry<String, URI> entitySet = entitySets.entrySet().iterator().next();
+		Assert.assertEquals("sources1", entitySet.getKey());
+		Assert.assertEquals("http://localhost:8080/odata.svc/sources1", entitySet.getValue().toString());
+
+		Map<String,URI> singletons = serviceDocument.getSingletons();
+		Assert.assertEquals(0, singletons.size());
+
+		Map<String,URI> functionImports = serviceDocument.getFunctionImports();
+		Assert.assertEquals(0, functionImports.size());
+	}
+
+	@Test
+	public void testMetadata() throws InterruptedException {
+        //Thread.sleep(60000);
+		String serviceRoot = "http://localhost:8080/odata.svc";
+
+		ODataClient client = ODataClientFactory.getV4();
+		EdmMetadataRequest request =
+	        client.getRetrieveRequestFactory().getMetadataRequest(serviceRoot);
+		ODataRetrieveResponse<Edm> response = request.execute();
+		
+		Edm edm = response.getBody();
+		
+		List<EdmSchema> schemas = edm.getSchemas();
+		for (EdmSchema schema : schemas) {
+			System.out.println(schema.getNamespace());
+			System.out.println(">> schema.getComplexTypes() size = "+schema.getComplexTypes().size());
+			for (EdmComplexType complexType : schema.getComplexTypes()) {
+				System.out.println("- complex type = "+complexType);
+			}
+			System.out.println(">> schema.getEntityTypes() size = "+schema.getEntityTypes().size());
+			for (EdmEntityType entityType : schema.getEntityTypes()) {
+				System.out.println("- entity type = "+entityType);
+				System.out.println("    >> qn = "+entityType.getFullQualifiedName());
+			}
+		}
+		
+		//edm.get
+		EdmEntityType customerType = edm.getEntityType(
+	            new FullQualifiedName("NorthwindModel", "Order"));
+		List<String> propertyNames = customerType.getPropertyNames();
+		for (String propertyName : propertyNames) {
+			System.out.println(" - propertyName = "+propertyName);
+			EdmProperty property = customerType.getStructuralProperty(propertyName);
+			FullQualifiedName typeName = property.getType().getFullQualifiedName();
+			System.out.println("   - type name = "+typeName);
+		}
+	}
+}


Mime
View raw message