You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2010/02/26 10:41:07 UTC

svn commit: r916629 - in /incubator/aries/trunk/jpa: ./ jpa-blueprint-testbundle/ jpa-blueprint-testbundle/src/ jpa-blueprint-testbundle/src/main/ jpa-blueprint-testbundle/src/main/java/ jpa-blueprint-testbundle/src/main/java/org/ jpa-blueprint-testbun...

Author: timothyjward
Date: Fri Feb 26 09:41:07 2010
New Revision: 916629

URL: http://svn.apache.org/viewvc?rev=916629&view=rev
Log:
ARIES-202 : Separate the JPA blueprint integration from managed persistence contexts

Added:
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/pom.xml
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
Modified:
    incubator/aries/trunk/jpa/jpa-container-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
    incubator/aries/trunk/jpa/pom.xml

Added: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/pom.xml?rev=916629&view=auto
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/pom.xml (added)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/pom.xml Fri Feb 26 09:41:07 2010
@@ -0,0 +1,58 @@
+<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/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>jpa</artifactId>
+    <groupId>org.apache.aries.jpa</groupId>
+    <version>1.0.0-incubating-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>org.apache.aries.jpa.blueprint.itest.bundle</artifactId>
+  <packaging>bundle</packaging>
+  <version>1.0.0-incubating-SNAPSHOT</version>
+  <name>Test Bundle for Aries JPA Blueprint iTests</name>
+  <dependencies>
+  	<dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jpa_2.0_spec</artifactId>
+    </dependency>
+  </dependencies>
+  
+        <build>
+       <resources>
+            <resource>
+                <targetPath>OSGI-INF/persistence</targetPath>
+                <filtering>false</filtering>
+                <directory>${basedir}/src/main/resources/OSGI-INF/persistence</directory>
+                <includes>
+                    <include>*.xml</include>
+                </includes>
+            </resource>
+            <resource>
+                <targetPath>OSGI-INF/blueprint</targetPath>
+                <filtering>false</filtering>
+                <directory>${basedir}/src/main/resources/OSGI-INF/blueprint</directory>
+                <includes>
+                    <include>*.xml</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
+                        <Import-Package>
+                            javax.persistence;version="[1.0.0,3.0.0)",
+                            *
+                        </Import-Package>
+                        <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
+                        <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Bundle-DocURL</_removeheaders>
+                        <Meta-Persistence>OSGI-INF/persistence/persistence.xml</Meta-Persistence>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Added: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java?rev=916629&view=auto
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java (added)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java Fri Feb 26 09:41:07 2010
@@ -0,0 +1,36 @@
+package org.apache.aries.jpa.blueprint.itest;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+
+public class JPATestBean {
+  
+  private EntityManagerFactory emf;
+  
+  private EntityManager em;
+  
+  public void setPUnit(EntityManagerFactory pUnit) {
+    emf = pUnit;
+  }
+
+  public void setPContext(EntityManager pContext) {
+    em = pContext;
+  }
+  
+  /**
+   * @return True if we sucessfully called a method on the EMF
+   */
+  public boolean isPUnit() {
+    emf.isOpen();
+    return true;
+  }
+  
+  /**
+   * @return True if we sucessfully called a method on the EM
+   */
+  public boolean isPContext() {
+    em.isOpen();
+    return true;
+  }
+  
+}

Added: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java?rev=916629&view=auto
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java (added)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java Fri Feb 26 09:41:07 2010
@@ -0,0 +1,50 @@
+package org.apache.aries.jpa.blueprint.itest.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class Car {
+  @Id
+  private String numberPlate;
+  
+  private String colour;
+  
+  private int engineSize;
+  
+  private int numberOfSeats;
+
+  public String getNumberPlate() {
+    return numberPlate;
+  }
+
+  public void setNumberPlate(String numberPlate) {
+    this.numberPlate = numberPlate;
+  }
+
+  public String getColour() {
+    return colour;
+  }
+
+  public void setColour(String colour) {
+    this.colour = colour;
+  }
+
+  public int getEngineSize() {
+    return engineSize;
+  }
+
+  public void setEngineSize(int engineSize) {
+    this.engineSize = engineSize;
+  }
+
+  public int getNumberOfSeats() {
+    return numberOfSeats;
+  }
+
+  public void setNumberOfSeats(int numberOfSeats) {
+    this.numberOfSeats = numberOfSeats;
+  }
+  
+  
+}

Added: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml?rev=916629&view=auto
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml (added)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml Fri Feb 26 09:41:07 2010
@@ -0,0 +1,30 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+  
+  <bean id="test" class="org.apache.aries.jpa.blueprint.itest.JPATestBean">
+    <jpa:unit property="pUnit" unitname="test-unit"/>
+    <jpa:unit property="pContext" unitname="test-context"/>
+  </bean>
+            
+</blueprint>
\ No newline at end of file

Added: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml?rev=916629&view=auto
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml (added)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml Fri Feb 26 09:41:07 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+   version="1.0">
+  
+  <persistence-unit name="test-unit" transaction-type="JTA">
+    <description>Test persistence unit for the JPA Blueprint integration iTest</description>
+    <class>org.apache.aries.jpa.blueprint.itest.entities.Car</class>
+    <exclude-unlisted-classes/>
+  </persistence-unit>
+  <persistence-unit name="test-context" transaction-type="JTA">
+    <description>Test persistence context for the JPA Integration iTest</description>
+    <class>org.apache.aries.jpa.blueprint.itest.entities.Car</class>
+    <exclude-unlisted-classes/>
+  </persistence-unit>
+</persistence>
\ No newline at end of file

Modified: incubator/aries/trunk/jpa/jpa-container-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-container-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml?rev=916629&r1=916628&r2=916629&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-container-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml (original)
+++ incubator/aries/trunk/jpa/jpa-container-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml Fri Feb 26 09:41:07 2010
@@ -5,7 +5,7 @@
    version="1.0">
   
   <persistence-unit name="test-unit" transaction-type="RESOURCE_LOCAL">
-    <description>Test persistence unit for the JPA Container iTest</description>
+    <description>Test persistence unit for the JPA Container and Context iTests</description>
     <class>org.apache.aries.jpa.container.itest.entities.Car</class>
     <exclude-unlisted-classes/>
     <properties>

Modified: incubator/aries/trunk/jpa/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/pom.xml?rev=916629&r1=916628&r2=916629&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/pom.xml (original)
+++ incubator/aries/trunk/jpa/pom.xml Fri Feb 26 09:41:07 2010
@@ -36,6 +36,7 @@
   	<module>jpa-container-itest</module>
   	<module>jpa-container-testbundle</module>
   	<module>jpa-context-itest</module>
+  	<module>jpa-blueprint-testbundle</module>
   </modules>
   <dependencyManagement>
     <dependencies>