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/10/14 20:35:00 UTC
[13/39] git commit: Fix line endings
Fix line endings
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/7ab8cd93
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/7ab8cd93
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/7ab8cd93
Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: 7ab8cd93ef0d17f290021c3453bc4013516ed76f
Parents: 4966ebe
Author: mibo <mi...@mirb.de>
Authored: Mon Oct 6 10:35:50 2014 +0200
Committer: mibo <mi...@mirb.de>
Committed: Mon Oct 6 10:35:50 2014 +0200
----------------------------------------------------------------------
odata2-jpa-processor/jpa-api/.gitignore | 14 +-
.../processor/api/ODataJPAResponseBuilder.java | 316 ++---
.../processor/api/ODataJPATombstoneContext.java | 180 +--
.../api/ODataJPATombstoneEntityListener.java | 120 +-
.../jpa/processor/api/OnJPAWriteContent.java | 108 +-
.../jpa/processor/api/access/JPAPaging.java | 64 +-
.../api/exception/ODataJPAErrorCallback.java | 90 +-
odata2-jpa-processor/jpa-core/.gitignore | 14 +-
.../processor/core/access/data/JPAEntity.java | 896 +++++++-------
.../jpa/processor/core/access/data/JPAPage.java | 422 +++----
.../core/callback/JPATombstoneCallBack.java | 120 +-
.../jpa/processor/core/model/JPAEdmFacets.java | 188 +--
.../processor/core/ODataEntityParserTest.java | 488 ++++----
.../JPAEntityParserForStaticMethodTest.java | 660 +++++------
.../core/access/data/JPAEntityTest.java | 492 ++++----
.../processor/core/access/data/JPALinkTest.java | 46 +-
.../access/data/JPAPageBuilderDeltaTest.java | 714 +++++------
.../core/access/data/JPAPageBuilderTest.java | 1120 +++++++++---------
.../processor/core/mock/ODataContextMock.java | 124 +-
.../core/mock/ODataJPAServiceFactoryMock.java | 94 +-
.../processor/core/mock/ODataServiceMock.java | 212 ++--
.../core/mock/OnJPAWriteContentMock.java | 116 +-
.../jpa/processor/core/mock/PathInfoMock.java | 102 +-
.../processor/core/mock/PathSegmentMock.java | 88 +-
.../processor/core/mock/data/EdmMockUtilV2.java | 806 ++++++-------
.../processor/core/mock/data/JPATypeMock.java | 536 ++++-----
.../core/mock/data/ODataEntryMockUtil.java | 328 ++---
.../core/mock/model/JPAPluralAttributeMock.java | 188 +--
odata2-jpa-processor/jpa-ref/.gitignore | 14 +-
.../ref/converter/BlobToByteConverter.java | 140 +--
.../ref/factory/JPAEntityManagerFactory.java | 92 +-
.../SalesOrderItemTombstoneListener.java | 186 +--
.../listeners/SalesOrderTombstoneListener.java | 114 +-
.../odata2/jpa/processor/ref/model/Address.java | 188 +--
.../jpa/processor/ref/model/Category.java | 160 +--
.../jpa/processor/ref/model/Customer.java | 186 +--
.../jpa/processor/ref/model/Material.java | 272 ++---
.../odata2/jpa/processor/ref/model/Note.java | 242 ++--
.../odata2/jpa/processor/ref/model/NoteKey.java | 166 +--
.../jpa/processor/ref/model/SalesOrderItem.java | 270 ++---
.../processor/ref/model/SalesOrderItemKey.java | 178 +--
.../odata2/jpa/processor/ref/model/Store.java | 182 +--
.../src/main/resources/META-INF/persistence.xml | 88 +-
odata2-jpa-processor/jpa-web/.gitignore | 14 +-
.../ref/extension/OnDBWriteContent.java | 110 +-
.../jpa/processor/ref/extension/OrderValue.java | 84 +-
.../jpa/processor/ref/util/DataGenerator.java | 316 ++---
.../src/main/resources/SQL_Cleanup.properties | 42 +-
.../resources/SQL_Insert_Category.properties | 42 +-
.../main/resources/SQL_Insert_Config.properties | 42 +-
.../resources/SQL_Insert_Customer.properties | 44 +-
.../resources/SQL_Insert_Material.properties | 58 +-
.../SQL_Insert_SalesOrderHeader.properties | 58 +-
.../SQL_Insert_SalesOrderItem.properties | 60 +-
.../main/resources/SQL_Insert_Store.properties | 58 +-
.../src/main/resources/serviceConfig.properties | 36 +-
.../jpa-web/src/main/webapp/WEB-INF/web.xml | 54 +-
.../jpa-web/src/main/webapp/index.jsp | 664 +++++------
odata2-lib/odata-annotation/.gitignore | 16 +-
.../src/main/java/META-INF/MANIFEST.MF | 6 +-
60 files changed, 6414 insertions(+), 6414 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-api/.gitignore
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/.gitignore b/odata2-jpa-processor/jpa-api/.gitignore
index fe5d89b..a7ffe90 100644
--- a/odata2-jpa-processor/jpa-api/.gitignore
+++ b/odata2-jpa-processor/jpa-api/.gitignore
@@ -1,8 +1,8 @@
-.project
-.classpath
-.settings
-target
-bin
-*.bak
-classes
+.project
+.classpath
+.settings
+target
+bin
+*.bak
+classes
.DS_Store
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java
index cc9bffc..d0d1912 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java
@@ -1,158 +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.odata2.jpa.processor.api;
-
-import java.util.List;
-
-import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
-import org.apache.olingo.odata2.api.processor.ODataResponse;
-import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
-import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo;
-import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
-import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
-import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-
-/**
- * The interface provides methods for building an OData response from a JPA Entity.
- * Implement this interface for building an OData response from a JPA Entity.
- */
-public interface ODataJPAResponseBuilder {
-
- /**
- * The method builds an OData response for an OData Query Request from a queried list of JPA Entities.
- * @param queryUriInfo is an information about the request URI
- * @param jpaEntities is an empty or non empty list of queried instances of JPA Entities
- * @param contentType of the response
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- */
- public ODataResponse build(final GetEntitySetUriInfo queryUriInfo, final List<Object> jpaEntities,
- final String contentType) throws ODataJPARuntimeException;
-
- /**
- * The method builds an OData response for an OData Read Request from a read JPA Entity
- * @param readUriInfo is an information about the request URI
- * @param jpaEntity is a null or non null instances of read JPA Entity
- * @param contentType of the response
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- * @throws ODataNotFoundException
- */
- public ODataResponse build(final GetEntityUriInfo readUriInfo, final Object jpaEntity,
- final String contentType) throws ODataJPARuntimeException,
- ODataNotFoundException;
-
- /**
- * The method builds an OData response for an OData Create Request from a created JPA entity.
- * @param postUriInfo is an information about the request URI
- * @param createdObject is a null or non null instances of JPA Entity
- * @param contentType of the response
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- * @throws ODataNotFoundException
- */
- public ODataResponse build(final PostUriInfo postUriInfo, final Object createdObject,
- final String contentType) throws ODataJPARuntimeException,
- ODataNotFoundException;
-
- /**
- * The method builds an OData response for an OData Update Request from an updated JPA Entity
- * @param putUriInfo is an information about the request URI
- * @param updatedObject is an updated instance of JPA Entity
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- * @throws ODataNotFoundException
- */
- public ODataResponse build(final PutMergePatchUriInfo putUriInfo, final Object updatedObject)
- throws ODataJPARuntimeException, ODataNotFoundException;
-
- /**
- * The method builds an OData response for an OData Delete Request from a deleted JPA Entity
- * @param deleteUriInfo is an information about the request URI
- * @param deletedObject is an null or non null instance of deleted JPA Entity. Null implies Entity not found.
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- * @throws ODataNotFoundException
- */
- public ODataResponse build(final DeleteUriInfo deleteUriInfo, final Object deletedObject)
- throws ODataJPARuntimeException, ODataNotFoundException;
-
- /**
- * The method builds an OData response for an OData function Import Request from a registered processor method's
- * return parameter.
- * @param functionImportUriInfo is an information about the request URI
- * @param result is a method's return parameter
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- */
- public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final Object result)
- throws ODataJPARuntimeException;
-
- /**
- * The method builds an OData response for an OData function Import Request from a registered processor method's
- * return parameter. The return parameter is a collection of objects.
- * @param functionImportUriInfo is an information about the request URI
- * @param result is a method's return parameter is a collection of objects.
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- */
- public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final List<Object> resultList,
- final String contentType)
- throws ODataJPARuntimeException, ODataNotFoundException;
-
- /**
- * The method builds an OData response for an OData Read Link Request from a read JPA Entity and its related JPA
- * Entities.
- * @param readLinkUriInfo is an information about the request URI
- * @param jpaEntity is a null or non null read JPA Entity and its related JPA Entities.
- * @param contentType of the response
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataNotFoundException
- * @throws ODataJPARuntimeException
- */
- public ODataResponse build(final GetEntityLinkUriInfo readLinkUriInfo, final Object jpaEntity,
- final String contentType) throws ODataNotFoundException,
- ODataJPARuntimeException;
-
- /**
- * The method builds an OData response for an OData Query Link Request from a queried JPA Entity and its related JPA
- * Entities.
- * @param queryLinkUriInfo is an information about the request URI
- * @param jpaEntity is an empty or non empty list of queried JPA Entities
- * @param contentType of the response
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- */
- public ODataResponse build(final GetEntitySetLinksUriInfo queryLinkUriInfo, final List<Object> jpaEntity,
- final String contentType) throws ODataJPARuntimeException;
-
- /**
- * The method builds an OData response from a count representing total number of JPA Entities
- * @param jpaEntityCount is the count value
- * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
- * @throws ODataJPARuntimeException
- */
- public ODataResponse build(final long jpaEntityCount)
- throws ODataJPARuntimeException;
-
-}
+/*******************************************************************************
+ * 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.jpa.processor.api;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+
+/**
+ * The interface provides methods for building an OData response from a JPA Entity.
+ * Implement this interface for building an OData response from a JPA Entity.
+ */
+public interface ODataJPAResponseBuilder {
+
+ /**
+ * The method builds an OData response for an OData Query Request from a queried list of JPA Entities.
+ * @param queryUriInfo is an information about the request URI
+ * @param jpaEntities is an empty or non empty list of queried instances of JPA Entities
+ * @param contentType of the response
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ */
+ public ODataResponse build(final GetEntitySetUriInfo queryUriInfo, final List<Object> jpaEntities,
+ final String contentType) throws ODataJPARuntimeException;
+
+ /**
+ * The method builds an OData response for an OData Read Request from a read JPA Entity
+ * @param readUriInfo is an information about the request URI
+ * @param jpaEntity is a null or non null instances of read JPA Entity
+ * @param contentType of the response
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ * @throws ODataNotFoundException
+ */
+ public ODataResponse build(final GetEntityUriInfo readUriInfo, final Object jpaEntity,
+ final String contentType) throws ODataJPARuntimeException,
+ ODataNotFoundException;
+
+ /**
+ * The method builds an OData response for an OData Create Request from a created JPA entity.
+ * @param postUriInfo is an information about the request URI
+ * @param createdObject is a null or non null instances of JPA Entity
+ * @param contentType of the response
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ * @throws ODataNotFoundException
+ */
+ public ODataResponse build(final PostUriInfo postUriInfo, final Object createdObject,
+ final String contentType) throws ODataJPARuntimeException,
+ ODataNotFoundException;
+
+ /**
+ * The method builds an OData response for an OData Update Request from an updated JPA Entity
+ * @param putUriInfo is an information about the request URI
+ * @param updatedObject is an updated instance of JPA Entity
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ * @throws ODataNotFoundException
+ */
+ public ODataResponse build(final PutMergePatchUriInfo putUriInfo, final Object updatedObject)
+ throws ODataJPARuntimeException, ODataNotFoundException;
+
+ /**
+ * The method builds an OData response for an OData Delete Request from a deleted JPA Entity
+ * @param deleteUriInfo is an information about the request URI
+ * @param deletedObject is an null or non null instance of deleted JPA Entity. Null implies Entity not found.
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ * @throws ODataNotFoundException
+ */
+ public ODataResponse build(final DeleteUriInfo deleteUriInfo, final Object deletedObject)
+ throws ODataJPARuntimeException, ODataNotFoundException;
+
+ /**
+ * The method builds an OData response for an OData function Import Request from a registered processor method's
+ * return parameter.
+ * @param functionImportUriInfo is an information about the request URI
+ * @param result is a method's return parameter
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ */
+ public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final Object result)
+ throws ODataJPARuntimeException;
+
+ /**
+ * The method builds an OData response for an OData function Import Request from a registered processor method's
+ * return parameter. The return parameter is a collection of objects.
+ * @param functionImportUriInfo is an information about the request URI
+ * @param result is a method's return parameter is a collection of objects.
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ */
+ public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final List<Object> resultList,
+ final String contentType)
+ throws ODataJPARuntimeException, ODataNotFoundException;
+
+ /**
+ * The method builds an OData response for an OData Read Link Request from a read JPA Entity and its related JPA
+ * Entities.
+ * @param readLinkUriInfo is an information about the request URI
+ * @param jpaEntity is a null or non null read JPA Entity and its related JPA Entities.
+ * @param contentType of the response
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataNotFoundException
+ * @throws ODataJPARuntimeException
+ */
+ public ODataResponse build(final GetEntityLinkUriInfo readLinkUriInfo, final Object jpaEntity,
+ final String contentType) throws ODataNotFoundException,
+ ODataJPARuntimeException;
+
+ /**
+ * The method builds an OData response for an OData Query Link Request from a queried JPA Entity and its related JPA
+ * Entities.
+ * @param queryLinkUriInfo is an information about the request URI
+ * @param jpaEntity is an empty or non empty list of queried JPA Entities
+ * @param contentType of the response
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ */
+ public ODataResponse build(final GetEntitySetLinksUriInfo queryLinkUriInfo, final List<Object> jpaEntity,
+ final String contentType) throws ODataJPARuntimeException;
+
+ /**
+ * The method builds an OData response from a count representing total number of JPA Entities
+ * @param jpaEntityCount is the count value
+ * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse}
+ * @throws ODataJPARuntimeException
+ */
+ public ODataResponse build(final long jpaEntityCount)
+ throws ODataJPARuntimeException;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java
index cb946a0..7229d14 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * 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.jpa.processor.api;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * This class provides a thread safe container for accessing Tombstone objects
- *
- */
-public final class ODataJPATombstoneContext {
-
- private static final ThreadLocal<String> deltaToken = new ThreadLocal<String>();
- private static final ThreadLocal<Long> deltaTokenUTCTimeStamp = new ThreadLocal<Long>();
- private static final ThreadLocal<HashMap<String, List<Object>>> deltas =
- new ThreadLocal<HashMap<String, List<Object>>>();
-
- public static String getDeltaToken() {
- return deltaToken.get();
- }
-
- public static void setDeltaToken(final String token) {
- deltaToken.set(token);
- }
-
- public static void addToDeltaResult(final Object entity, final String entityName) {
- HashMap<String, List<Object>> entityDeltaMap = deltas.get();
- if (entityDeltaMap == null) {
- deltas.set(new HashMap<String, List<Object>>());
- }
- entityDeltaMap = deltas.get();
- if (entityDeltaMap.get(entityName) == null) {
- entityDeltaMap.put(entityName, new ArrayList<Object>());
- }
- entityDeltaMap.get(entityName).add(entity);
- }
-
- public static List<Object> getDeltaResult(final String entityName) {
- HashMap<String, List<Object>> entityDeltaMap = deltas.get();
- if (entityDeltaMap != null) {
- return entityDeltaMap.get(entityName);
- } else {
- return null;
- }
- }
-
- public static void cleanup() {
- deltas.remove();
- deltaToken.remove();
- deltaTokenUTCTimeStamp.remove();
- }
-
- public static Long getDeltaTokenUTCTimeStamp() {
- Long timestamp = deltaTokenUTCTimeStamp.get();
-
- if (timestamp != null) {
- return timestamp;
- } else if (deltaToken.get() != null) {
- try {
- timestamp = new Long(Long.parseLong(deltaToken.get()));
- } catch (NumberFormatException e) {
- return null;
- }
- deltaTokenUTCTimeStamp.set(timestamp);
- } else {
- deltaTokenUTCTimeStamp.set(new Long(0L));
- }
-
- return deltaTokenUTCTimeStamp.get();
- }
-
-}
+/*******************************************************************************
+ * 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.jpa.processor.api;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * This class provides a thread safe container for accessing Tombstone objects
+ *
+ */
+public final class ODataJPATombstoneContext {
+
+ private static final ThreadLocal<String> deltaToken = new ThreadLocal<String>();
+ private static final ThreadLocal<Long> deltaTokenUTCTimeStamp = new ThreadLocal<Long>();
+ private static final ThreadLocal<HashMap<String, List<Object>>> deltas =
+ new ThreadLocal<HashMap<String, List<Object>>>();
+
+ public static String getDeltaToken() {
+ return deltaToken.get();
+ }
+
+ public static void setDeltaToken(final String token) {
+ deltaToken.set(token);
+ }
+
+ public static void addToDeltaResult(final Object entity, final String entityName) {
+ HashMap<String, List<Object>> entityDeltaMap = deltas.get();
+ if (entityDeltaMap == null) {
+ deltas.set(new HashMap<String, List<Object>>());
+ }
+ entityDeltaMap = deltas.get();
+ if (entityDeltaMap.get(entityName) == null) {
+ entityDeltaMap.put(entityName, new ArrayList<Object>());
+ }
+ entityDeltaMap.get(entityName).add(entity);
+ }
+
+ public static List<Object> getDeltaResult(final String entityName) {
+ HashMap<String, List<Object>> entityDeltaMap = deltas.get();
+ if (entityDeltaMap != null) {
+ return entityDeltaMap.get(entityName);
+ } else {
+ return null;
+ }
+ }
+
+ public static void cleanup() {
+ deltas.remove();
+ deltaToken.remove();
+ deltaTokenUTCTimeStamp.remove();
+ }
+
+ public static Long getDeltaTokenUTCTimeStamp() {
+ Long timestamp = deltaTokenUTCTimeStamp.get();
+
+ if (timestamp != null) {
+ return timestamp;
+ } else if (deltaToken.get() != null) {
+ try {
+ timestamp = new Long(Long.parseLong(deltaToken.get()));
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ deltaTokenUTCTimeStamp.set(timestamp);
+ } else {
+ deltaTokenUTCTimeStamp.set(new Long(0L));
+ }
+
+ return deltaTokenUTCTimeStamp.get();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java
index ec28842..148fa38 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * 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.jpa.processor.api;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-
-/**
- * Extend this class and implement a JPA Entity Listener as specified in JSR 317 Java Persistence 2.0.
- * The class provides abstract methods that shall be implemented by JPA application to handle OData Tombstone features.
- * The implemented JPA Entity Listener classes will be called back from OData JPA Processor Library.
- */
-public abstract class ODataJPATombstoneEntityListener {
-
- public ODataJPATombstoneEntityListener() {}
-
- protected final void addToDelta(final Object entity, final String entityName) {
- ODataJPATombstoneContext.addToDeltaResult(entity, entityName);
- }
-
- /**
- * Implement this method to create a {@link javax.persistence.Query} object. The Query object can be created from
- * OData requests. The query instance thus created can be used for handling delta JPA entities. The delta token passed
- * from OData request can
- * be accessed from {@link com.sap.core.odata.processor.api.jpa.ODataJPATombstoneContext}.
- * @param resultsView is a reference to OData request
- * @param em is a reference to {@link javax.persistence.EntityManager}
- * @return an instance of type {@link javax.persistence.Query}
- */
- public abstract Query getQuery(GetEntitySetUriInfo resultsView, EntityManager em);
-
- /**
- * Implement this method to create a delta token.
- * @param deltas is list of delta JPA Entities
- * @param query is an instance of type {@link javax.persistence.Query} that was used for handling delta entites
- * @return a delta token of type String
- */
- public abstract String generateDeltaToken(List<Object> deltas, Query query);
-
-}
+/*******************************************************************************
+ * 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.jpa.processor.api;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+
+/**
+ * Extend this class and implement a JPA Entity Listener as specified in JSR 317 Java Persistence 2.0.
+ * The class provides abstract methods that shall be implemented by JPA application to handle OData Tombstone features.
+ * The implemented JPA Entity Listener classes will be called back from OData JPA Processor Library.
+ */
+public abstract class ODataJPATombstoneEntityListener {
+
+ public ODataJPATombstoneEntityListener() {}
+
+ protected final void addToDelta(final Object entity, final String entityName) {
+ ODataJPATombstoneContext.addToDeltaResult(entity, entityName);
+ }
+
+ /**
+ * Implement this method to create a {@link javax.persistence.Query} object. The Query object can be created from
+ * OData requests. The query instance thus created can be used for handling delta JPA entities. The delta token passed
+ * from OData request can
+ * be accessed from {@link com.sap.core.odata.processor.api.jpa.ODataJPATombstoneContext}.
+ * @param resultsView is a reference to OData request
+ * @param em is a reference to {@link javax.persistence.EntityManager}
+ * @return an instance of type {@link javax.persistence.Query}
+ */
+ public abstract Query getQuery(GetEntitySetUriInfo resultsView, EntityManager em);
+
+ /**
+ * Implement this method to create a delta token.
+ * @param deltas is list of delta JPA Entities
+ * @param query is an instance of type {@link javax.persistence.Query} that was used for handling delta entites
+ * @return a delta token of type String
+ */
+ public abstract String generateDeltaToken(List<Object> deltas, Query query);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java
index 6be7492..37ef6d1 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * 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.jpa.processor.api;
-
-import java.sql.Blob;
-import java.sql.Clob;
-
-import org.apache.olingo.odata2.api.ODataCallback;
-import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-
-/**
- * <p> The interface is a call back interface that enables OData JPA Processor to get JPA provider specific
- * implementation
- * of <b>java.sql.Blob</b> and <b>java.sql.Clob</b> instances.</p>
- * <p>
- * Implement this interface if the JPA Model uses the data types java.sql.Blob and java.sql.Clob for its entity
- * properties. </p>
- *
- *
- */
-public interface OnJPAWriteContent extends ODataCallback {
-
- /**
- * Implement this method to instantiate JPA provider specific implementation of java.sql.Blob instance from an array
- * of bytes.
- * @param binaryData is an array of bytes
- * @return an instance of type {@link java.sql.Blob}
- */
- public Blob getJPABlob(byte[] binaryData) throws ODataJPARuntimeException;
-
- /**
- * Implement this method to instantiate JPA provider specific implementation of java.sql.Clob instance from an array
- * of characters.
- * @param characterData is an array of characters
- * @return an instance of type {@link java.sql.Clob}
- */
- public Clob getJPAClob(char[] characterData) throws ODataJPARuntimeException;
-}
+/*******************************************************************************
+ * 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.jpa.processor.api;
+
+import java.sql.Blob;
+import java.sql.Clob;
+
+import org.apache.olingo.odata2.api.ODataCallback;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+
+/**
+ * <p> The interface is a call back interface that enables OData JPA Processor to get JPA provider specific
+ * implementation
+ * of <b>java.sql.Blob</b> and <b>java.sql.Clob</b> instances.</p>
+ * <p>
+ * Implement this interface if the JPA Model uses the data types java.sql.Blob and java.sql.Clob for its entity
+ * properties. </p>
+ *
+ *
+ */
+public interface OnJPAWriteContent extends ODataCallback {
+
+ /**
+ * Implement this method to instantiate JPA provider specific implementation of java.sql.Blob instance from an array
+ * of bytes.
+ * @param binaryData is an array of bytes
+ * @return an instance of type {@link java.sql.Blob}
+ */
+ public Blob getJPABlob(byte[] binaryData) throws ODataJPARuntimeException;
+
+ /**
+ * Implement this method to instantiate JPA provider specific implementation of java.sql.Clob instance from an array
+ * of characters.
+ * @param characterData is an array of characters
+ * @return an instance of type {@link java.sql.Clob}
+ */
+ public Clob getJPAClob(char[] characterData) throws ODataJPARuntimeException;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java
index 2e3881f..3c1821d 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * 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.jpa.processor.api.access;
-
-import java.util.List;
-
-public interface JPAPaging {
- public int getPageSize();
-
- public List<Object> getPagedEntities();
-
- public int getNextPage();
-
- public int getStartPage();
-
-}
+/*******************************************************************************
+ * 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.jpa.processor.api.access;
+
+import java.util.List;
+
+public interface JPAPaging {
+ public int getPageSize();
+
+ public List<Object> getPagedEntities();
+
+ public int getNextPage();
+
+ public int getStartPage();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java
index 4482f61..fa044f1 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * 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.jpa.processor.api.exception;
-
-import org.apache.olingo.odata2.api.ep.EntityProvider;
-import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-import org.apache.olingo.odata2.api.processor.ODataErrorCallback;
-import org.apache.olingo.odata2.api.processor.ODataErrorContext;
-import org.apache.olingo.odata2.api.processor.ODataResponse;
-
-public class ODataJPAErrorCallback implements ODataErrorCallback {
-
- @Override
- public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException {
-
- final String SEPARATOR = " : ";
-
- Throwable t = context.getException();
- if (t instanceof ODataJPAException && t.getCause() != null) {
- StringBuilder errorBuilder = new StringBuilder();
- errorBuilder.append(t.getCause().getClass().toString());
- errorBuilder.append(SEPARATOR);
- errorBuilder.append(t.getCause().getMessage());
- context.setInnerError(errorBuilder.toString());
- }
- return EntityProvider.writeErrorDocument(context);
- }
-
-}
+/*******************************************************************************
+ * 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.jpa.processor.api.exception;
+
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+import org.apache.olingo.odata2.api.processor.ODataErrorCallback;
+import org.apache.olingo.odata2.api.processor.ODataErrorContext;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+
+public class ODataJPAErrorCallback implements ODataErrorCallback {
+
+ @Override
+ public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException {
+
+ final String SEPARATOR = " : ";
+
+ Throwable t = context.getException();
+ if (t instanceof ODataJPAException && t.getCause() != null) {
+ StringBuilder errorBuilder = new StringBuilder();
+ errorBuilder.append(t.getCause().getClass().toString());
+ errorBuilder.append(SEPARATOR);
+ errorBuilder.append(t.getCause().getMessage());
+ context.setInnerError(errorBuilder.toString());
+ }
+ return EntityProvider.writeErrorDocument(context);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-core/.gitignore
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/.gitignore b/odata2-jpa-processor/jpa-core/.gitignore
index fe5d89b..a7ffe90 100644
--- a/odata2-jpa-processor/jpa-core/.gitignore
+++ b/odata2-jpa-processor/jpa-core/.gitignore
@@ -1,8 +1,8 @@
-.project
-.classpath
-.settings
-target
-bin
-*.bak
-classes
+.project
+.classpath
+.settings
+target
+bin
+*.bak
+classes
.DS_Store
\ No newline at end of file