olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [17/37] olingo-odata2 git commit: [OLINGO-193] Moved all spring related into spring extension module
Date Tue, 27 Jan 2015 19:25:15 GMT
[OLINGO-193] Moved all spring related into spring extension module


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

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: 986b1c4b4c45bfa0b156928108f2fe5ae6410236
Parents: 1ee1ff4
Author: Michael Bolz <michael.bolz@sap.com>
Authored: Tue Dec 23 13:51:06 2014 +0100
Committer: Michael Bolz <michael.bolz@sap.com>
Committed: Tue Dec 23 13:56:35 2014 +0100

----------------------------------------------------------------------
 .../odata2/core/rest/ODataRootLocator.java      |  98 +++++++++----
 .../core/rest/spring/ODataRootLocator.java      | 138 -------------------
 odata2-spring/pom.xml                           |   1 -
 .../olingo/odata2/spring/OlingoRootLocator.java | 134 ++++++++++++++++++
 .../spring/OlingoServerDefinitionParser.java    |  39 ++++--
 .../src/main/resources/schema/olingo.xsd        |   2 +-
 .../spring/SpringNamespaceHandlerTest.java      |  20 +--
 .../resources/spring/applicationContext.xml     |   2 +-
 8 files changed, 247 insertions(+), 187 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataRootLocator.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataRootLocator.java
b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataRootLocator.java
index 64f9d4f..3ff5984 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataRootLocator.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/ODataRootLocator.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
@@ -18,13 +18,24 @@
  ******************************************************************************/
 package org.apache.olingo.odata2.core.rest;
 
+import java.util.List;
+
 import javax.servlet.ServletConfig;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Encoded;
+import javax.ws.rs.HeaderParam;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
 
 import org.apache.olingo.odata2.api.ODataServiceFactory;
+import org.apache.olingo.odata2.api.exception.ODataBadRequestException;
+import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 import org.apache.olingo.odata2.core.rest.app.AbstractODataApplication;
 
@@ -38,40 +49,77 @@ import org.apache.olingo.odata2.core.rest.app.AbstractODataApplication;
  * The first segment defined by a servlet mapping belong to customer context and the following
segments are OData
  * specific.
  * </p>
- * 
+ *
  */
 @Path("/")
-public class ODataRootLocator extends
-    org.apache.olingo.odata2.core.rest.spring.ODataRootLocator {
+public class ODataRootLocator {
 
   @Context
+  private HttpHeaders httpHeaders;
+  @Context
+  private UriInfo uriInfo;
+  @Context
+  private Request request;
+  @Context
   private ServletConfig servletConfig;
+  @Context
+  private HttpServletRequest servletRequest;
 
-  @Override
-  public ODataServiceFactory getServiceFactory() {
-    return createServiceFactoryFromContext(app, servletRequest,
-        servletConfig);
-  }
+  @Context
+  private Application app;
 
-  @Override
-  public void setServiceFactory(ODataServiceFactory serviceFactory) {
-    // Don't do anything
-  }
+  /**
+   * Default root behavior which will delegate all paths to a ODataLocator.
+   * @param pathSegments URI path segments - all segments have to be OData
+   * @param xHttpMethod HTTP Header X-HTTP-Method for tunneling through POST
+   * @param xHttpMethodOverride HTTP Header X-HTTP-Method-Override for tunneling through
POST
+   * @return a locator handling OData protocol
+   * @throws ODataException
+   * @throws ClassNotFoundException
+   * @throws IllegalAccessException
+   * @throws InstantiationException
+   */
+  @Path("/{pathSegments: .*}")
+  public Object handleRequest(
+      @Encoded @PathParam("pathSegments") final List<PathSegment> pathSegments,
+      @HeaderParam("X-HTTP-Method") final String xHttpMethod,
+      @HeaderParam("X-HTTP-Method-Override") final String xHttpMethodOverride)
+      throws ODataException, ClassNotFoundException, InstantiationException, IllegalAccessException
{
+
+    if (xHttpMethod != null && xHttpMethodOverride != null) {
+
+      /*
+       * X-HTTP-Method-Override : implemented by CXF
+       * X-HTTP-Method : implemented in ODataSubLocator:handlePost
+       */
+
+      if (!xHttpMethod.equalsIgnoreCase(xHttpMethodOverride)) {
+        throw new ODataBadRequestException(ODataBadRequestException.AMBIGUOUS_XMETHOD);
+      }
+    }
+
+    if (servletRequest.getPathInfo() == null) {
+      return handleRedirect();
+    }
+
+    ODataServiceFactory serviceFactory = createServiceFactoryFromContext(app, servletRequest,
servletConfig);
 
-  @Override
-  public int getPathSplit() {
     int pathSplit = 0;
-    final String pathSplitAsString = servletConfig
-        .getInitParameter(ODataServiceFactory.PATH_SPLIT_LABEL);
+    final String pathSplitAsString = servletConfig.getInitParameter(ODataServiceFactory.PATH_SPLIT_LABEL);
     if (pathSplitAsString != null) {
       pathSplit = Integer.parseInt(pathSplitAsString);
     }
-    return pathSplit;
-  }
 
-  @Override
-  public void setPathSplit(int pathSplit) {
-    // Don't do anything
+    final SubLocatorParameter param = new SubLocatorParameter();
+    param.setServiceFactory(serviceFactory);
+    param.setPathSegments(pathSegments);
+    param.setHttpHeaders(httpHeaders);
+    param.setUriInfo(uriInfo);
+    param.setRequest(request);
+    param.setServletRequest(servletRequest);
+    param.setPathSplit(pathSplit);
+
+    return ODataSubLocator.create(param);
   }
 
   public static ODataServiceFactory createServiceFactoryFromContext(final Application app,
@@ -100,4 +148,8 @@ public class ODataRootLocator extends
       throw new ODataRuntimeException("Exception during ODataServiceFactory creation occured.",
e);
     }
   }
+
+  private Object handleRedirect() {
+    return new ODataRedirectLocator();
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/spring/ODataRootLocator.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/spring/ODataRootLocator.java
b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/spring/ODataRootLocator.java
deleted file mode 100644
index ea143e7..0000000
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/spring/ODataRootLocator.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.core.rest.spring;
-
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Encoded;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.PathSegment;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.olingo.odata2.api.ODataServiceFactory;
-import org.apache.olingo.odata2.api.exception.ODataBadRequestException;
-import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.core.rest.ODataRedirectLocator;
-import org.apache.olingo.odata2.core.rest.ODataSubLocator;
-import org.apache.olingo.odata2.core.rest.SubLocatorParameter;
-
-/**
- * Default OData root locator responsible to handle the whole path and delegate all calls
to a sub locator:<p>
- * <code>/{odata path} e.g. http://host:port/webapp/odata.svc/$metadata</code><br>
- * All path segments defined by a servlet mapping belong to the odata uri.
- * </p>
- * This behavior can be changed:<p>
- * <code>/{custom path}{odata path} e.g. http://host:port/webapp/bmw/odata.svc/$metadata</code><br>
- * The first segment defined by a servlet mapping belong to customer context and the following
segments are OData
- * specific.
- * </p>
- *
- */
-@Path("/")
-public class ODataRootLocator {
-
-  @Context
-  private HttpHeaders httpHeaders;
-  @Context
-  private UriInfo uriInfo;
-  @Context
-  private Request request;
-  @Context
-  protected HttpServletRequest servletRequest;
-
-  @Context
-  protected Application app;
-
-  // These next two members are exposed so that they can be injected with Spring
-  private ODataServiceFactory serviceFactory;
-  private int pathSplit = 0;
-
-  /**
-   * Default root behavior which will delegate all paths to a ODataLocator.
-   * @param pathSegments URI path segments - all segments have to be OData
-   * @param xHttpMethod HTTP Header X-HTTP-Method for tunneling through POST
-   * @param xHttpMethodOverride HTTP Header X-HTTP-Method-Override for tunneling through
POST
-   * @return a locator handling OData protocol
-   * @throws ODataException
-   * @throws ClassNotFoundException
-   * @throws IllegalAccessException
-   * @throws InstantiationException
-   */
-  @Path("/{pathSegments: .*}")
-  public Object handleRequest(
-      @Encoded @PathParam("pathSegments") final List<PathSegment> pathSegments,
-      @HeaderParam("X-HTTP-Method") final String xHttpMethod,
-      @HeaderParam("X-HTTP-Method-Override") final String xHttpMethodOverride)
-      throws ODataException, ClassNotFoundException, InstantiationException, IllegalAccessException
{
-
-    if (xHttpMethod != null && xHttpMethodOverride != null) {
-
-      /*
-       * X-HTTP-Method-Override : implemented by CXF
-       * X-HTTP-Method : implemented in ODataSubLocator:handlePost
-       */
-
-      if (!xHttpMethod.equalsIgnoreCase(xHttpMethodOverride)) {
-        throw new ODataBadRequestException(ODataBadRequestException.AMBIGUOUS_XMETHOD);
-      }
-    }
-
-    if (servletRequest.getPathInfo() == null) {
-      return handleRedirect();
-    }
-
-    final SubLocatorParameter param = new SubLocatorParameter();
-    param.setServiceFactory(getServiceFactory());
-    param.setPathSegments(pathSegments);
-    param.setHttpHeaders(httpHeaders);
-    param.setUriInfo(uriInfo);
-    param.setRequest(request);
-    param.setServletRequest(servletRequest);
-    param.setPathSplit(getPathSplit());
-
-    return ODataSubLocator.create(param);
-  }
-
-  private Object handleRedirect() {
-    return new ODataRedirectLocator();
-  }
-
-  public ODataServiceFactory getServiceFactory() {
-    return serviceFactory;
-  }
-
-  public void setServiceFactory(ODataServiceFactory serviceFactory) {
-    this.serviceFactory = serviceFactory;
-  }
-
-  public int getPathSplit() {
-    return pathSplit;
-  }
-
-  public void setPathSplit(int pathSplit) {
-    this.pathSplit = pathSplit;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-spring/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-spring/pom.xml b/odata2-spring/pom.xml
index 5183719..ed1c7b3 100755
--- a/odata2-spring/pom.xml
+++ b/odata2-spring/pom.xml
@@ -75,7 +75,6 @@
 			<groupId>javax.servlet</groupId>
 			<artifactId>servlet-api</artifactId>
 			<version>2.5</version>
-			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>commons-logging</groupId>

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoRootLocator.java
----------------------------------------------------------------------
diff --git a/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoRootLocator.java
b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoRootLocator.java
new file mode 100644
index 0000000..bf60cb6
--- /dev/null
+++ b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoRootLocator.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * 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.odata2.spring;
+
+import org.apache.olingo.odata2.api.ODataServiceFactory;
+import org.apache.olingo.odata2.api.exception.ODataBadRequestException;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.core.rest.ODataRedirectLocator;
+import org.apache.olingo.odata2.core.rest.ODataSubLocator;
+import org.apache.olingo.odata2.core.rest.SubLocatorParameter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Encoded;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+import java.util.List;
+
+/**
+ * Default OData root locator responsible to handle the whole path and delegate all calls
to a sub locator:<p>
+ * <code>/{odata path} e.g. http://host:port/webapp/odata.svc/$metadata</code><br>
+ * All path segments defined by a servlet mapping belong to the odata uri.
+ * </p>
+ * This behavior can be changed:<p>
+ * <code>/{custom path}{odata path} e.g. http://host:port/webapp/bmw/odata.svc/$metadata</code><br>
+ * The first segment defined by a servlet mapping belong to customer context and the following
segments are OData
+ * specific.
+ * </p>
+ *
+ */
+@Path("/")
+public class OlingoRootLocator {
+
+  @Context
+  private HttpHeaders httpHeaders;
+  @Context
+  private UriInfo uriInfo;
+  @Context
+  private Request request;
+  @Context
+  private HttpServletRequest servletRequest;
+
+  // These next two members are exposed so that they can be injected with Spring
+  private ODataServiceFactory serviceFactory;
+  private int pathSplit = 0;
+
+  /**
+   * Default root behavior which will delegate all paths to a ODataLocator.
+   * @param pathSegments URI path segments - all segments have to be OData
+   * @param xHttpMethod HTTP Header X-HTTP-Method for tunneling through POST
+   * @param xHttpMethodOverride HTTP Header X-HTTP-Method-Override for tunneling through
POST
+   * @return a locator handling OData protocol
+   * @throws org.apache.olingo.odata2.api.exception.ODataException
+   * @throws ClassNotFoundException
+   * @throws IllegalAccessException
+   * @throws InstantiationException
+   */
+  @Path("/{pathSegments: .*}")
+  public Object handleRequest(
+      @Encoded @PathParam("pathSegments") final List<PathSegment> pathSegments,
+      @HeaderParam("X-HTTP-Method") final String xHttpMethod,
+      @HeaderParam("X-HTTP-Method-Override") final String xHttpMethodOverride)
+      throws ODataException, ClassNotFoundException, InstantiationException, IllegalAccessException
{
+
+    if (xHttpMethod != null && xHttpMethodOverride != null) {
+
+      /*
+       * X-HTTP-Method-Override : implemented by CXF
+       * X-HTTP-Method : implemented in ODataSubLocator:handlePost
+       */
+
+      if (!xHttpMethod.equalsIgnoreCase(xHttpMethodOverride)) {
+        throw new ODataBadRequestException(ODataBadRequestException.AMBIGUOUS_XMETHOD);
+      }
+    }
+
+    if (servletRequest.getPathInfo() == null) {
+      return handleRedirect();
+    }
+
+    final SubLocatorParameter param = new SubLocatorParameter();
+    param.setServiceFactory(getServiceFactory());
+    param.setPathSegments(pathSegments);
+    param.setHttpHeaders(httpHeaders);
+    param.setUriInfo(uriInfo);
+    param.setRequest(request);
+    param.setServletRequest(servletRequest);
+    param.setPathSplit(getPathSplit());
+
+    return ODataSubLocator.create(param);
+  }
+
+  private Object handleRedirect() {
+    return new ODataRedirectLocator();
+  }
+
+  public ODataServiceFactory getServiceFactory() {
+    return serviceFactory;
+  }
+
+  public void setServiceFactory(ODataServiceFactory serviceFactory) {
+    this.serviceFactory = serviceFactory;
+  }
+
+  public int getPathSplit() {
+    return pathSplit;
+  }
+
+  public void setPathSplit(int pathSplit) {
+    this.pathSplit = pathSplit;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoServerDefinitionParser.java
----------------------------------------------------------------------
diff --git a/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoServerDefinitionParser.java
b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoServerDefinitionParser.java
index a8e7f77..c517ad4 100755
--- a/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoServerDefinitionParser.java
+++ b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoServerDefinitionParser.java
@@ -21,7 +21,6 @@ package org.apache.olingo.odata2.spring;
 import org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser;
 import org.apache.olingo.odata2.core.rest.ODataExceptionMapperImpl;
 import org.apache.olingo.odata2.core.rest.app.ODataApplication;
-import org.apache.olingo.odata2.core.rest.spring.ODataRootLocator;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanDefinitionHolder;
 import org.springframework.beans.factory.support.AbstractBeanDefinition;
@@ -30,8 +29,20 @@ import org.springframework.beans.factory.support.ManagedList;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.w3c.dom.Element;
 
+/**
+ *
+ */
 public class OlingoServerDefinitionParser extends JAXRSServerFactoryBeanDefinitionParser
{
 
+  protected static final String OLINGO_ROOT_LOCATOR = "OlingoRootLocator";
+  protected static final String OLINGO_ODATA_PROVIDER = "OlingoODataProvider";
+  protected static final String OLINGO_ODATA_EXCEPTION_HANDLER = "OlingoODataExceptionHandler";
+  protected static final String SERVICE_FACTORY = "serviceFactory";
+  protected static final String SERVICE_BEANS = "serviceBeans";
+  protected static final String ID = "id";
+  protected static final String FACTORY = "factory";
+  protected static final String PATH_SPLIT = "pathSplit";
+
   public OlingoServerDefinitionParser() {
     super();
     setBeanClass(SpringJAXRSServerFactoryBean.class);
@@ -39,7 +50,7 @@ public class OlingoServerDefinitionParser extends JAXRSServerFactoryBeanDefiniti
 
   @Override
   protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String name, String
val) {
-    if ("id".equals(name) || "address".equals(name)) {
+    if (ID.equals(name) || "address".equals(name)) {
       mapToProperty(bean, name, val);
     }
   }
@@ -48,38 +59,38 @@ public class OlingoServerDefinitionParser extends JAXRSServerFactoryBeanDefiniti
   protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder
bean) {
     super.doParse(element, parserContext, bean);
 
-    if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataExceptionHandler"))
{
+    if (!parserContext.getRegistry().containsBeanDefinition(OLINGO_ODATA_EXCEPTION_HANDLER))
{
       AbstractBeanDefinition definition =
           BeanDefinitionBuilder.genericBeanDefinition(ODataExceptionMapperImpl.class).getBeanDefinition();
       definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
-      BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataExceptionHandler",
new String[0]);
+      BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, OLINGO_ODATA_EXCEPTION_HANDLER,
new String[0]);
       registerBeanDefinition(holder, parserContext.getRegistry());
     }
 
-    if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataProvider")) {
+    if (!parserContext.getRegistry().containsBeanDefinition(OLINGO_ODATA_PROVIDER)) {
       AbstractBeanDefinition definition =
           BeanDefinitionBuilder.genericBeanDefinition(ODataApplication.MyProvider.class).getBeanDefinition();
       definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
-      BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataProvider",
new String[0]);
+      BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, OLINGO_ODATA_PROVIDER,
new String[0]);
       registerBeanDefinition(holder, parserContext.getRegistry());
     }
 
-    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ODataRootLocator.class);
+    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(OlingoRootLocator.class);
     builder.setScope(BeanDefinition.SCOPE_PROTOTYPE);
-    builder.addPropertyReference("serviceFactory", element.getAttribute("factory"));
-    if (element.hasAttribute("pathsplit")) {
-      builder.addPropertyValue("pathSplit", element.getAttribute("pathsplit"));
+    builder.addPropertyReference(SERVICE_FACTORY, element.getAttribute(FACTORY));
+    if (element.hasAttribute(PATH_SPLIT)) {
+      builder.addPropertyValue(PATH_SPLIT, element.getAttribute(PATH_SPLIT));
     }
     AbstractBeanDefinition definition = builder.getBeanDefinition();
     BeanDefinitionHolder holder = new BeanDefinitionHolder(definition,
-        "OlingoODataRootLocator-" + element.getAttribute("id") + "-" + element.getAttribute("factory"),
new String[0]);
+        OLINGO_ROOT_LOCATOR + "-" + element.getAttribute(ID) + "-" + element.getAttribute(FACTORY));
     registerBeanDefinition(holder, parserContext.getRegistry());
 
     ManagedList<BeanDefinition> services = new ManagedList<BeanDefinition>(3);
     services.add(definition);
-    services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataExceptionHandler"));
-    services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataProvider"));
-    bean.addPropertyValue("serviceBeans", services);
+    services.add(parserContext.getRegistry().getBeanDefinition(OLINGO_ODATA_EXCEPTION_HANDLER));
+    services.add(parserContext.getRegistry().getBeanDefinition(OLINGO_ODATA_PROVIDER));
+    bean.addPropertyValue(SERVICE_BEANS, services);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-spring/src/main/resources/schema/olingo.xsd
----------------------------------------------------------------------
diff --git a/odata2-spring/src/main/resources/schema/olingo.xsd b/odata2-spring/src/main/resources/schema/olingo.xsd
index 39424dd..436eb74 100755
--- a/odata2-spring/src/main/resources/schema/olingo.xsd
+++ b/odata2-spring/src/main/resources/schema/olingo.xsd
@@ -24,7 +24,7 @@
 				<xsd:extension base="beans:identifiedType">
 					<xsd:attribute name="address" type="xsd:string" use="required" />
 					<xsd:attribute name="factory" type="xsd:string" use="required" />
-					<xsd:attribute name="pathsplit" type="xsd:int" use="optional" />
+					<xsd:attribute name="pathSplit" type="xsd:int" use="optional" />
 				</xsd:extension>
 			</xsd:complexContent>
 		</xsd:complexType>

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-spring/src/test/java/org/apache/olingo/odata2/spring/SpringNamespaceHandlerTest.java
----------------------------------------------------------------------
diff --git a/odata2-spring/src/test/java/org/apache/olingo/odata2/spring/SpringNamespaceHandlerTest.java
b/odata2-spring/src/test/java/org/apache/olingo/odata2/spring/SpringNamespaceHandlerTest.java
index 81a2372..089cfe3 100755
--- a/odata2-spring/src/test/java/org/apache/olingo/odata2/spring/SpringNamespaceHandlerTest.java
+++ b/odata2-spring/src/test/java/org/apache/olingo/odata2/spring/SpringNamespaceHandlerTest.java
@@ -18,12 +18,9 @@
  ******************************************************************************/
 package org.apache.olingo.odata2.spring;
 
-import static org.junit.Assert.*;
-
 import org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser.SpringJAXRSServerFactoryBean;
 import org.apache.olingo.odata2.core.rest.ODataExceptionMapperImpl;
 import org.apache.olingo.odata2.core.rest.app.ODataApplication;
-import org.apache.olingo.odata2.core.rest.spring.ODataRootLocator;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +29,11 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.test.context.web.WebAppConfiguration;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration("classpath:spring/applicationContext.xml")
 @WebAppConfiguration
@@ -44,15 +46,15 @@ public class SpringNamespaceHandlerTest {
   public void testSuccessfullyCreated() {
     assertTrue(appCtx.containsBean("testServer"));
 
-    assertTrue(appCtx.containsBean("OlingoODataExceptionHandler"));
-    assertTrue(appCtx.containsBean("OlingoODataProvider"));
+    assertTrue(appCtx.containsBean(OlingoServerDefinitionParser.OLINGO_ODATA_EXCEPTION_HANDLER));
+    assertTrue(appCtx.containsBean(OlingoServerDefinitionParser.OLINGO_ODATA_PROVIDER));
 
     assertEquals(ODataExceptionMapperImpl.class, appCtx.getType("OlingoODataExceptionHandler"));
     assertEquals(ODataApplication.MyProvider.class, appCtx.getType("OlingoODataProvider"));
 
-    String rootLocatorName = "OlingoODataRootLocator-testServer-serviceFactory";
+    String rootLocatorName = "OlingoRootLocator-testServer-serviceFactory";
     assertTrue(appCtx.containsBean(rootLocatorName));
-    assertEquals(ODataRootLocator.class, appCtx.getType(rootLocatorName));
+    assertEquals(OlingoRootLocator.class, appCtx.getType(rootLocatorName));
 
     SpringJAXRSServerFactoryBean server = appCtx.getBean("testServer", SpringJAXRSServerFactoryBean.class);
     assertEquals("/service.svc", server.getAddress());
@@ -60,8 +62,8 @@ public class SpringNamespaceHandlerTest {
 
   @Test
   public void testCorrectFactoryAndPathSplit() {
-    String rootLocatorName = "OlingoODataRootLocator-testServer-serviceFactory";
-    ODataRootLocator rootLocator = appCtx.getBean(rootLocatorName, ODataRootLocator.class);
+    String rootLocatorName = "OlingoRootLocator-testServer-serviceFactory";
+    OlingoRootLocator rootLocator = appCtx.getBean(rootLocatorName, OlingoRootLocator.class);
     assertNotNull(rootLocator.getServiceFactory());
     assertSame(appCtx.getBean("serviceFactory"), rootLocator.getServiceFactory());
     assertEquals(3, rootLocator.getPathSplit());

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/986b1c4b/odata2-spring/src/test/resources/spring/applicationContext.xml
----------------------------------------------------------------------
diff --git a/odata2-spring/src/test/resources/spring/applicationContext.xml b/odata2-spring/src/test/resources/spring/applicationContext.xml
index 567c8da..31e9cd8 100755
--- a/odata2-spring/src/test/resources/spring/applicationContext.xml
+++ b/odata2-spring/src/test/resources/spring/applicationContext.xml
@@ -24,7 +24,7 @@
 	<bean id="serviceFactory" class="org.apache.olingo.odata2.spring.TestFactory" />
 
 	<!-- This is what is actually being tested -->
-	<odata:server id="testServer" address="/service.svc" factory="serviceFactory" pathsplit="3"/>
+	<odata:server id="testServer" address="/service.svc" factory="serviceFactory" pathSplit="3"/>
 
 	<!-- In order to be useful in a real environment, Apache CXF needs to be configured correctly
as well.
 	     This context file doesn't handle this, since the unit test only tests that the namespace
handler


Mime
View raw message