Repository: olingo-odata4
Updated Branches:
  refs/heads/OLINGO-549-ODataV4-JPA e3a20bb9e -> 503acb0c9


[OLINGO-765] Initial version of odata-jpa-core

Signed-off-by: Chandan V A <[email protected]>

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

Branch: refs/heads/OLINGO-549-ODataV4-JPA
Commit: 503acb0c9c899299fe016ea15f7d77a8f4e96e9e
Parents: e3a20bb
Author: Chandan V A <[email protected]>
Authored: Sun Aug 23 12:57:12 2015 +0530
Committer: Chandan V A <[email protected]>
Committed: Sun Aug 23 12:57:12 2015 +0530

----------------------------------------------------------------------
 ext/odata-jpa/odata-jpa-core/pom.xml            |  6 +-
 .../olingo/jpa/core/ODataJPAContextImpl.java    | 37 +++++++++++
 .../jpa/core/edm/ODataJPAEdmProvider.java       | 25 ++++++++
 .../exception/ODataJPARuntimeException.java     | 49 +++++++++++++++
 .../jpa/core/factory/ODataJPAFactoryImpl.java   | 64 ++++++++++++++++++++
 .../core/osgi/ODataJPATransactionFactory.java   | 23 +++++++
 ...pache.olingo.jpa.api.factory.ODataJPAFactory | 19 ++++++
 .../OSGI-INF/odata-jpa-transaction.xml          | 23 +++++++
 .../odata-jpa-core-exception-i18n.properties    | 21 +++++++
 ext/odata-jpa/pom.xml                           |  7 ++-
 10 files changed, 272 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/pom.xml
----------------------------------------------------------------------
diff --git a/ext/odata-jpa/odata-jpa-core/pom.xml 
b/ext/odata-jpa/odata-jpa-core/pom.xml
index fbbf03a..2567339 100644
--- a/ext/odata-jpa/odata-jpa-core/pom.xml
+++ b/ext/odata-jpa/odata-jpa-core/pom.xml
@@ -29,8 +29,12 @@
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
-
                        <scope>test</scope>
                </dependency>
+               <dependency>
+                       <groupId>org.apache.olingo</groupId>
+                       <artifactId>odata-jpa-api</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
        </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/ODataJPAContextImpl.java
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/ODataJPAContextImpl.java
 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/ODataJPAContextImpl.java
new file mode 100644
index 0000000..a6308fa
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/ODataJPAContextImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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.jpa.core;
+
+import org.apache.olingo.jpa.api.ODataJPAContext;
+
+public class ODataJPAContextImpl implements ODataJPAContext {
+
+  @Override
+  public String getPersistenceUnitName() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public void setPersistenceUnitName() {
+    // TODO Auto-generated method stub
+    
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/edm/ODataJPAEdmProvider.java
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/edm/ODataJPAEdmProvider.java
 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/edm/ODataJPAEdmProvider.java
new file mode 100644
index 0000000..44811db
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/edm/ODataJPAEdmProvider.java
@@ -0,0 +1,25 @@
+/*
+ * 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.jpa.core.edm;
+
+import org.apache.olingo.jpa.api.ODataJPAAbstractEdmProvider;
+
+public class ODataJPAEdmProvider extends ODataJPAAbstractEdmProvider {
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/exception/ODataJPARuntimeException.java
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/exception/ODataJPARuntimeException.java
 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/exception/ODataJPARuntimeException.java
new file mode 100644
index 0000000..0731d2b
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/exception/ODataJPARuntimeException.java
@@ -0,0 +1,49 @@
+/*
+ * 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.jpa.core.exception;
+
+import org.apache.olingo.jpa.api.exception.ODataJPAException;
+
+public class ODataJPARuntimeException extends ODataJPAException {
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+  private static final String DEFAULT_BUNDLE_NAME = 
"odata-jpa-core-exception-i18n";
+
+  public static enum MessageKeys implements MessageKey {
+    NULL_PUNIT;
+
+    @Override
+    public String getKey() {
+      return name();
+    }
+  }
+
+  public ODataJPARuntimeException(String developmentMessage, Throwable cause, 
MessageKey messageKey,
+      String[] parameters) {
+    super(developmentMessage, cause, messageKey, parameters);
+  }
+
+  @Override
+  protected String getBundleName() {
+    return DEFAULT_BUNDLE_NAME;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/factory/ODataJPAFactoryImpl.java
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/factory/ODataJPAFactoryImpl.java
 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/factory/ODataJPAFactoryImpl.java
new file mode 100644
index 0000000..18299fb
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/factory/ODataJPAFactoryImpl.java
@@ -0,0 +1,64 @@
+/*
+ * 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.jpa.core.factory;
+
+import java.util.HashMap;
+
+import org.apache.olingo.jpa.api.ODataJPAAbstractEdmProvider;
+import org.apache.olingo.jpa.api.ODataJPAContext;
+import org.apache.olingo.jpa.api.ODataJPAProcessor;
+import org.apache.olingo.jpa.api.factory.ODataJPAFactory;
+import org.apache.olingo.jpa.core.ODataJPAContextImpl;
+import org.apache.olingo.jpa.core.edm.ODataJPAEdmProvider;
+import org.apache.olingo.jpa.core.exception.ODataJPARuntimeException;
+
+public class ODataJPAFactoryImpl extends ODataJPAFactory {
+
+  private HashMap<String, ODataJPAAbstractEdmProvider> edmProviderMap =
+      new HashMap<String, ODataJPAAbstractEdmProvider>();
+
+  @Override
+  public ODataJPAAbstractEdmProvider getODataJPAEdmProvider(String pUnitName) 
throws ODataJPARuntimeException {
+    ODataJPAAbstractEdmProvider odataJPAEdmProvider = null;
+    if (pUnitName == null) {
+      throw new ODataJPARuntimeException("Unable to create Edm Provider", null,
+          ODataJPARuntimeException.MessageKeys.NULL_PUNIT, null);
+    } else {
+      odataJPAEdmProvider = edmProviderMap.get(pUnitName);
+      if (odataJPAEdmProvider == null) {
+        odataJPAEdmProvider = new ODataJPAEdmProvider();
+        edmProviderMap.put(pUnitName, odataJPAEdmProvider);
+      }
+    }
+
+    return odataJPAEdmProvider;
+  }
+
+  @Override
+  public ODataJPAProcessor getODataJPAProcessor(ODataJPAContext 
odataJPAContext) {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public ODataJPAContext newODataJPAContext() {
+    return new ODataJPAContextImpl();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/osgi/ODataJPATransactionFactory.java
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/osgi/ODataJPATransactionFactory.java
 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/osgi/ODataJPATransactionFactory.java
new file mode 100644
index 0000000..5ed154e
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/java/org/apache/olingo/jpa/core/osgi/ODataJPATransactionFactory.java
@@ -0,0 +1,23 @@
+/*
+ * 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.jpa.core.osgi;
+
+public class ODataJPATransactionFactory {
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/resources/META-INF/services/org.apache.olingo.jpa.api.factory.ODataJPAFactory
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/resources/META-INF/services/org.apache.olingo.jpa.api.factory.ODataJPAFactory
 
b/ext/odata-jpa/odata-jpa-core/src/main/resources/META-INF/services/org.apache.olingo.jpa.api.factory.ODataJPAFactory
new file mode 100644
index 0000000..c00fa07
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/resources/META-INF/services/org.apache.olingo.jpa.api.factory.ODataJPAFactory
@@ -0,0 +1,19 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+org.apache.olingo.jpa.core.factory.ODataJPAFactoryImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/resources/OSGI-INF/odata-jpa-transaction.xml
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/resources/OSGI-INF/odata-jpa-transaction.xml
 
b/ext/odata-jpa/odata-jpa-core/src/main/resources/OSGI-INF/odata-jpa-transaction.xml
new file mode 100644
index 0000000..63028c5
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/resources/OSGI-INF/odata-jpa-transaction.xml
@@ -0,0 +1,23 @@
+<?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.
+ -->
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"; 
name="odatajpatransaction">
+   <implementation 
class="org.apache.olingo.jpa.core.ODataJPATransactionConsumer"/>
+   <reference bind="bindODataJPATransaction" cardinality="0..1" 
interface="org.apache.olingo.jpa.api.ODataJPATransaction" 
name="ODataJPATransaction" policy="dynamic" unbind="unbindODataJPATransaction"/>
+</scr:component>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/odata-jpa-core/src/main/resources/odata-jpa-core-exception-i18n.properties
----------------------------------------------------------------------
diff --git 
a/ext/odata-jpa/odata-jpa-core/src/main/resources/odata-jpa-core-exception-i18n.properties
 
b/ext/odata-jpa/odata-jpa-core/src/main/resources/odata-jpa-core-exception-i18n.properties
new file mode 100644
index 0000000..91911c7
--- /dev/null
+++ 
b/ext/odata-jpa/odata-jpa-core/src/main/resources/odata-jpa-core-exception-i18n.properties
@@ -0,0 +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.
+#-------------------------------------------------------------------------------
+# Basic Apache Olingo exception messages
+#
+ODataJPARuntimeException.NULL_PUNIT = "Persistence Unit Name cannot be null" 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/503acb0c/ext/odata-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/ext/odata-jpa/pom.xml b/ext/odata-jpa/pom.xml
index 41c8752..1640cf0 100644
--- a/ext/odata-jpa/pom.xml
+++ b/ext/odata-jpa/pom.xml
@@ -25,7 +25,7 @@
                <relativePath>..</relativePath>
        </parent>
        <properties>
-               <version.odata>4.0.0-beta-03-SNAPSHOT</version.odata>
+               <version.odata>4.0.0-beta-03</version.odata>
                <version.eclipselink>2.5.1</version.eclipselink>
                <version.javax.persistence>2.0.5</version.javax.persistence>
                <version.javax.servlet>2.5</version.javax.servlet>
@@ -64,6 +64,11 @@
                        </dependency>
                        <dependency>
                                <groupId>org.apache.olingo</groupId>
+                               <artifactId>odata-server-api</artifactId>
+                               <version>${version.odata}</version>
+                       </dependency>
+                       <dependency>
+                               <groupId>org.apache.olingo</groupId>
                                <artifactId>odata-commons-api</artifactId>
                                <version>${version.odata}</version>
                        </dependency>

Reply via email to