From adcd61f0e1b1446313f55b267d108b62e9928688 Mon Sep 17 00:00:00 2001 From: Brett Meyer Date: Wed, 22 May 2013 16:28:15 -0400 Subject: [PATCH] HHH-8112 quickstart tutorial chapter --- .../docbook/quickstart/en-US/Author_Group.xml | 8 +- .../en-US/Hibernate_Getting_Started_Guide.xml | 3 +- .../en-US/content/tutorial_osgi.xml | 104 ++++++++++++++++++ .../OSGI-INF/blueprint/blueprint.xml | 10 +- .../OSGI-INF/blueprint/blueprint.xml | 9 +- .../OSGI-INF/blueprint/blueprint.xml | 9 +- 6 files changed, 138 insertions(+), 5 deletions(-) create mode 100644 documentation/src/main/docbook/quickstart/en-US/content/tutorial_osgi.xml diff --git a/documentation/src/main/docbook/quickstart/en-US/Author_Group.xml b/documentation/src/main/docbook/quickstart/en-US/Author_Group.xml index 77d800c8ec..1ebb7bcf73 100644 --- a/documentation/src/main/docbook/quickstart/en-US/Author_Group.xml +++ b/documentation/src/main/docbook/quickstart/en-US/Author_Group.xml @@ -31,6 +31,12 @@ Warski + + + Brett + Meyer + + @@ -52,4 +58,4 @@ - \ No newline at end of file + diff --git a/documentation/src/main/docbook/quickstart/en-US/Hibernate_Getting_Started_Guide.xml b/documentation/src/main/docbook/quickstart/en-US/Hibernate_Getting_Started_Guide.xml index 4b987cec14..ee9d89d04b 100644 --- a/documentation/src/main/docbook/quickstart/en-US/Hibernate_Getting_Started_Guide.xml +++ b/documentation/src/main/docbook/quickstart/en-US/Hibernate_Getting_Started_Guide.xml @@ -43,5 +43,6 @@ + - \ No newline at end of file + diff --git a/documentation/src/main/docbook/quickstart/en-US/content/tutorial_osgi.xml b/documentation/src/main/docbook/quickstart/en-US/content/tutorial_osgi.xml new file mode 100644 index 0000000000..fa95407e08 --- /dev/null +++ b/documentation/src/main/docbook/quickstart/en-US/content/tutorial_osgi.xml @@ -0,0 +1,104 @@ + + + + OSGi Tutorial + + + Hibernate targets the OSGi 4.3 spec or later and supports three types + of configurations. + + + + Container-Managed JPA + + + Unmanaged JPA + + + Unmanaged Native + + + + + + For more details about OSGi, the three configurations, hibernate-osgi, extensions points, and caveats, please + see the OSGi chapter of the Developer's Guide! + + +
+ + Project Overview + + + Each configuration has a QuickStart project located within the download bundle (under osgi). + The bundles can be used as-is within Apache Karaf. Feel free to use them as literal + "quick start" bundle templates. + +
+ +
+ + Project Structure + + + + osgi/datasource-h2.xml: Enterprise OSGi JPA usage can include a DataSource installed in the container. + The client bundle's persistence.xml references the DataSource through JNDI. For an + example, see how managed-jpa's persistence.xml calls out the + jta-data-source. + + + osgi/[project]/features.xml: This is arguably the most important "quick start" material. It defines + a single Karaf feature ("hibernate-test") that demonstrates the necessary 3rd party libraries and + bundle activation ordering. + + + osgi/[project]/pom.xml: The POM includes typical compile-time dependencies (JPA, OSGi Core, + OSGi Enterprise), as well as OSGi manifest data. + + + osgi/[project]/src/main/resources/OSGI-INF/blueprint/blueprint.xml: + The Blueprint includes container-managed EntityManager + injection (for managed-jpa), as well as demonstrations showing how to register + your custom implementations of Hibernate extension points. + + + osgi/[project]/src/main/resources/META-INF/persistence.xml or + osgi/[project]/src/main/resources/hibernate.cfg.xml: Note that the configurations + are no different than typical uses of Hibernate! + + + osgi/[project]/src/main/java/org/hibernate/osgitest/HibernateUtil.java: Demonstrates how to create an + EntityManagerFactory (JPA) or SessionFactory (Native) using hibernate-osgi's services. Note that in + managed-jpa, this is replaced by DataPointServiceImpl#entityManager, injected by + blueprint.xml (described above). + + +
+ +
+ + TODOs + + + + If using managed-jpa, features.xml will need the path to + datasource-h2.xml updated. + + +
+ +
+ + Karaf Commands + + + All three bundles include Karaf Commands that can be used directly on the Karaf command line to test + basic persistence operations ("dp:add [name]", "dp:getall", "dp:deleteall", etc.). I leave them in the + QuickStarts as a useful sanity check. + +
+ +
diff --git a/documentation/src/main/docbook/quickstart/tutorials/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/documentation/src/main/docbook/quickstart/tutorials/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml index d7f2a95a47..529a4e1790 100644 --- a/documentation/src/main/docbook/quickstart/tutorials/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/documentation/src/main/docbook/quickstart/tutorials/osgi/managed-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -23,13 +23,21 @@ xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"> + - + + + + diff --git a/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 896737d2e8..caea8e855f 100644 --- a/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -22,9 +22,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - + + + + diff --git a/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 81cf11eddc..8fa894121f 100644 --- a/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/documentation/src/main/docbook/quickstart/tutorials/osgi/unmanaged-native/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -22,9 +22,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - + + + +