You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2011/12/22 17:12:44 UTC

svn commit: r1222313 - in /openejb/trunk/openejb/examples/simple-osgi: simple-osgi-api/ simple-osgi-api/src/main/java/org/superbiz/osgi/ simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/ simple-osgi-client/ simple-osgi-client/src/main/resourc...

Author: jlmonteiro
Date: Thu Dec 22 16:12:43 2011
New Revision: 1222313

URL: http://svn.apache.org/viewvc?rev=1222313&view=rev
Log:
OPENEJB-1726 simple OSGI example

Added:
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorLocal.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorRemote.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/calculator/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/calculator/CalculatorBean.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/AddInterceptor.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/DeleteInterceptor.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movie.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movies.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/resources/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/resources/META-INF/
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/resources/META-INF/persistence.xml
Removed:
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorLocal.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/CalculatorRemote.java
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/CalculatorBean.java
Modified:
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml
    openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml

Modified: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml?rev=1222313&r1=1222312&r2=1222313&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml (original)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/pom.xml Thu Dec 22 16:12:43 2011
@@ -38,8 +38,10 @@
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
           <instructions>
-            <Export-Package>org.superbiz.osgi</Export-Package>
-            <Import-Package>javax.ejb</Import-Package>
+            <Export-Package>
+              org.superbiz.osgi.calculator
+            </Export-Package>
+            <Import-Package>*</Import-Package>
           </instructions>
         </configuration>
       </plugin>

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorLocal.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorLocal.java?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorLocal.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorLocal.java Thu Dec 22 16:12:43 2011
@@ -0,0 +1,34 @@
+/**
+ * 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.superbiz.osgi.calculator;
+
+import javax.ejb.Local;
+
+@Local
+public interface CalculatorLocal {
+    int add(int a, int b);
+
+    int subtract(int a, int b);
+
+    int multiply(int a, int b);
+
+    int divide(int a, int b);
+
+    int remainder(int a, int b);
+    
+    String sayHello();
+}

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorRemote.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorRemote.java?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorRemote.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-api/src/main/java/org/superbiz/osgi/calculator/CalculatorRemote.java Thu Dec 22 16:12:43 2011
@@ -0,0 +1,34 @@
+/**
+ * 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.superbiz.osgi.calculator;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface CalculatorRemote {
+    int add(int a, int b);
+
+    int subtract(int a, int b);
+
+    int multiply(int a, int b);
+
+    int divide(int a, int b);
+
+    int remainder(int a, int b);
+
+    String sayHello();
+}

Modified: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml?rev=1222313&r1=1222312&r2=1222313&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml (original)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/pom.xml Thu Dec 22 16:12:43 2011
@@ -40,7 +40,7 @@
           <instructions>
             <Import-Package>
               javax.ejb,
-              org.superbiz.osgi,
+              org.superbiz.osgi.calculator,
               org.apache.openejb.client;version="[4.0,5.0)"
             </Import-Package>
             <Include-Resource>${pom.basedir}/src/main/resources</Include-Resource>

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-client/src/main/resources/META-INF/spring/calculator-camel-ctx.xml Thu Dec 22 16:12:43 2011
@@ -0,0 +1,41 @@
+<?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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.8.3.xsd">
+
+  <camel:camelContext id="helloContext">
+    <camel:route id="TimerHelloRoute">
+      <camel:from uri="timer://helloTimer?fixedRate=true&amp;period=2000"/>
+      <camel:delay>
+        <camel:constant>1000</camel:constant>
+      </camel:delay>
+      <camel:log message="%%% Say Hello"/>
+    </camel:route>
+  </camel:camelContext>
+
+  <camel:camelContext id="calcRoute">
+    <camel:route id="TimerCalcRoute">
+      <camel:from uri="timer://calcTimer?fixedRate=true&amp;period=5000"/>
+      <camel:to uri="bean:org.superbiz.osgi.calculator.CalculatorRemote?method=sayHello"/>
+      <camel:log message=">>> Result : ${body}"/>
+    </camel:route>
+  </camel:camelContext>
+</beans>

Modified: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml?rev=1222313&r1=1222312&r2=1222313&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml (original)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/pom.xml Thu Dec 22 16:12:43 2011
@@ -38,7 +38,7 @@
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
           <instructions>
-            <Import-Package>javax.ejb,org.superbiz.osgi</Import-Package>
+            <Import-Package>*</Import-Package>
           </instructions>
         </configuration>
       </plugin>

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/calculator/CalculatorBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/calculator/CalculatorBean.java?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/calculator/CalculatorBean.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/calculator/CalculatorBean.java Thu Dec 22 16:12:43 2011
@@ -0,0 +1,51 @@
+/**
+ * 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.superbiz.osgi.calculator;
+
+import org.superbiz.osgi.calculator.CalculatorLocal;
+import org.superbiz.osgi.calculator.CalculatorRemote;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class CalculatorBean implements CalculatorLocal, CalculatorRemote {
+
+    public int add(int a, int b) {
+        return a + b;
+    }
+
+    public int subtract(int a, int b) {
+        return a - b;
+    }
+
+    public int multiply(int a, int b) {
+        return a * b;
+    }
+
+    public int divide(int a, int b) {
+        return a / b;
+    }
+
+    public int remainder(int a, int b) {
+        return a % b;
+    }
+
+    public String sayHello() {
+        return "Hello World!";
+    }
+
+}
\ No newline at end of file

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/AddInterceptor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/AddInterceptor.java?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/AddInterceptor.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/AddInterceptor.java Thu Dec 22 16:12:43 2011
@@ -0,0 +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.superbiz.osgi.moviefun;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class AddInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Add
+        return context.proceed();
+    }
+}
\ No newline at end of file

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/DeleteInterceptor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/DeleteInterceptor.java?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/DeleteInterceptor.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/DeleteInterceptor.java Thu Dec 22 16:12:43 2011
@@ -0,0 +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.superbiz.osgi.moviefun;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class DeleteInterceptor {
+
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception {
+        // Log Delete
+        return context.proceed();
+    }
+}

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movie.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movie.java?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movie.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movie.java Thu Dec 22 16:12:43 2011
@@ -0,0 +1,62 @@
+/**
+ * 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.superbiz.osgi.moviefun;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Movie {
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+
+}

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movies.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movies.java?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movies.java (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/java/org/superbiz/osgi/moviefun/Movies.java Thu Dec 22 16:12:43 2011
@@ -0,0 +1,59 @@
+/**
+ * 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.superbiz.osgi.moviefun;
+
+import javax.annotation.security.PermitAll;
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.interceptor.Interceptors;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import java.util.List;
+
+//START SNIPPET: code
+@Stateful
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.TRANSACTION)
+    private EntityManager entityManager;
+
+    @RolesAllowed({"Employee", "Manager"})
+    @TransactionAttribute(TransactionAttributeType.REQUIRED)
+    @Interceptors(AddInterceptor.class)
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    @RolesAllowed({"Manager"})
+    @TransactionAttribute(TransactionAttributeType.MANDATORY)
+    @Interceptors(DeleteInterceptor.class)
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    @PermitAll
+    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+}
+//END SNIPPET: code

Added: openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/resources/META-INF/persistence.xml?rev=1222313&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/resources/META-INF/persistence.xml (added)
+++ openejb/trunk/openejb/examples/simple-osgi/simple-osgi-core/src/main/resources/META-INF/persistence.xml Thu Dec 22 16:12:43 2011
@@ -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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+  <persistence-unit name="movie-unit">
+    <jta-data-source>movieDatabase</jta-data-source>
+    <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+    <class>org.superbiz.osgi.moviefun.Movie</class>
+
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>
\ No newline at end of file