You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/11/14 08:51:29 UTC
[2/2] olingo-odata2 git commit: [OLINGO-193] Minor code and license
clean up
[OLINGO-193] Minor code and license clean up
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/ee079873
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/ee079873
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/ee079873
Branch: refs/heads/OLINGO-193_SpringSupport
Commit: ee0798736eaff71a377d704067032c3add145567
Parents: dd98b32
Author: Michael Bolz <mi...@sap.com>
Authored: Fri Nov 14 08:46:52 2014 +0100
Committer: Michael Bolz <mi...@sap.com>
Committed: Fri Nov 14 08:46:52 2014 +0100
----------------------------------------------------------------------
odata2-spring/pom.xml | 8 ++
.../odata2/spring/OlingoNamespaceHandler.java | 28 ++++-
.../spring/OlingoServerDefinitionParser.java | 118 +++++++++++--------
.../src/main/resources/META-INF/spring.handlers | 7 ++
.../src/main/resources/META-INF/spring.schemas | 7 ++
.../src/main/resources/schema/olingo.xsd | 7 ++
6 files changed, 121 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/ee079873/odata2-spring/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-spring/pom.xml b/odata2-spring/pom.xml
index 75650d0..bf8f6a8 100755
--- a/odata2-spring/pom.xml
+++ b/odata2-spring/pom.xml
@@ -1,3 +1,11 @@
+<?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>
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/ee079873/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoNamespaceHandler.java
----------------------------------------------------------------------
diff --git a/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoNamespaceHandler.java b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoNamespaceHandler.java
index a141dde..9014733 100755
--- a/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoNamespaceHandler.java
+++ b/odata2-spring/src/main/java/org/apache/olingo/odata2/spring/OlingoNamespaceHandler.java
@@ -1,13 +1,29 @@
+/*******************************************************************************
+ * 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.springframework.beans.factory.xml.NamespaceHandlerSupport;
-
public class OlingoNamespaceHandler extends NamespaceHandlerSupport {
- @Override
- public void init() {
- registerBeanDefinitionParser("server", new OlingoServerDefinitionParser());
- }
-
+ @Override
+ public void init() {
+ registerBeanDefinitionParser("server", new OlingoServerDefinitionParser());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/ee079873/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 849e7a8..d4469a3 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
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser;
@@ -14,60 +32,64 @@ import org.w3c.dom.Element;
public class OlingoServerDefinitionParser extends JAXRSServerFactoryBeanDefinitionParser {
- public OlingoServerDefinitionParser() {
- super();
- setBeanClass(SpringJAXRSServerFactoryBean.class);
- }
+ public OlingoServerDefinitionParser() {
+ super();
+ setBeanClass(SpringJAXRSServerFactoryBean.class);
+ }
- @Override
- protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String name, String val) {
- if ("id".equals(name) || "address".equals(name)) {
- mapToProperty(bean, name, val);
- }
- }
+ @Override
+ protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String name, String val) {
+ if ("id".equals(name) || "address".equals(name)) {
+ mapToProperty(bean, name, val);
+ }
+ }
- @Override
- protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder bean) {
- super.doParse(element, parserContext, bean);
- ManagedList<BeanDefinition> services = new ManagedList<BeanDefinition>(3);
+ @Override
+ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder bean) {
+ super.doParse(element, parserContext, bean);
+ ManagedList<BeanDefinition> services = new ManagedList<BeanDefinition>(3);
- if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataExceptionHandler")) {
- AbstractBeanDefinition definition = BeanDefinitionBuilder.genericBeanDefinition(ODataExceptionMapperImpl.class).getBeanDefinition();
- definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataExceptionHandler", new String[0]);
- registerBeanDefinition(holder, parserContext.getRegistry());
- }
+ if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataExceptionHandler")) {
+ AbstractBeanDefinition definition =
+ BeanDefinitionBuilder.genericBeanDefinition(ODataExceptionMapperImpl.class).getBeanDefinition();
+ definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataExceptionHandler", new String[0]);
+ registerBeanDefinition(holder, parserContext.getRegistry());
+ }
- if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataProvider")) {
- AbstractBeanDefinition definition = BeanDefinitionBuilder.genericBeanDefinition(ODataApplication.MyProvider.class).getBeanDefinition();
- definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataProvider", new String[0]);
- registerBeanDefinition(holder, parserContext.getRegistry());
- }
+ if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataProvider")) {
+ AbstractBeanDefinition definition =
+ BeanDefinitionBuilder.genericBeanDefinition(ODataApplication.MyProvider.class).getBeanDefinition();
+ definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataProvider", new String[0]);
+ registerBeanDefinition(holder, parserContext.getRegistry());
+ }
- if (!element.hasAttribute("factory")) {
- if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataRootLocator")) {
- AbstractBeanDefinition definition = BeanDefinitionBuilder.genericBeanDefinition(ODataRootLocator.class).getBeanDefinition();
- definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataRootLocator", new String[0]);
- registerBeanDefinition(holder, parserContext.getRegistry());
- }
- services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataRootLocator"));
- }
- else {
- BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ODataRootLocator.class);
- builder.setScope(BeanDefinition.SCOPE_PROTOTYPE);
- builder.addPropertyReference("serviceFactory", element.getAttribute("factory"));
- AbstractBeanDefinition definition = builder.getBeanDefinition();
- BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataRootLocator-"+element.getAttribute("factory"), new String[0]);
- registerBeanDefinition(holder, parserContext.getRegistry());
- services.add(definition);
+ if (!element.hasAttribute("factory")) {
+ if (!parserContext.getRegistry().containsBeanDefinition("OlingoODataRootLocator")) {
+ AbstractBeanDefinition definition =
+ BeanDefinitionBuilder.genericBeanDefinition(ODataRootLocator.class).getBeanDefinition();
+ definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, "OlingoODataRootLocator", new String[0]);
+ registerBeanDefinition(holder, parserContext.getRegistry());
+ }
+ services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataRootLocator"));
+ } else {
+ BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ODataRootLocator.class);
+ builder.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+ builder.addPropertyReference("serviceFactory", element.getAttribute("factory"));
+ AbstractBeanDefinition definition = builder.getBeanDefinition();
+ BeanDefinitionHolder holder =
+ new BeanDefinitionHolder(definition, "OlingoODataRootLocator-" + element.getAttribute("factory"),
+ new String[0]);
+ registerBeanDefinition(holder, parserContext.getRegistry());
+ services.add(definition);
- }
+ }
- services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataExceptionHandler"));
- services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataProvider"));
- bean.addPropertyValue("serviceBeans", services);
- }
+ services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataExceptionHandler"));
+ services.add(parserContext.getRegistry().getBeanDefinition("OlingoODataProvider"));
+ bean.addPropertyValue("serviceBeans", services);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/ee079873/odata2-spring/src/main/resources/META-INF/spring.handlers
----------------------------------------------------------------------
diff --git a/odata2-spring/src/main/resources/META-INF/spring.handlers b/odata2-spring/src/main/resources/META-INF/spring.handlers
index 6f63fc8..4b9c4c5 100755
--- a/odata2-spring/src/main/resources/META-INF/spring.handlers
+++ b/odata2-spring/src/main/resources/META-INF/spring.handlers
@@ -1 +1,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. -->
http\://www.apache.org/olingo/odata2/spring/namespace=org.apache.olingo.odata2.spring.OlingoNamespaceHandler
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/ee079873/odata2-spring/src/main/resources/META-INF/spring.schemas
----------------------------------------------------------------------
diff --git a/odata2-spring/src/main/resources/META-INF/spring.schemas b/odata2-spring/src/main/resources/META-INF/spring.schemas
index 85b9a6d..f9ff528 100755
--- a/odata2-spring/src/main/resources/META-INF/spring.schemas
+++ b/odata2-spring/src/main/resources/META-INF/spring.schemas
@@ -1 +1,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. -->
http\://www.apache.org/olingo/odata2/spring/namespace.xsd=schema/olingo.xsd
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/ee079873/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 2b160e9..6818687 100755
--- a/odata2-spring/src/main/resources/schema/olingo.xsd
+++ b/odata2-spring/src/main/resources/schema/olingo.xsd
@@ -1,4 +1,11 @@
<?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. -->
<xsd:schema xmlns="http://www.apache.org/olingo/odata2/spring/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"