HHH-10041 features.xml generation: collapse 3 mains into one hibernate-orm

This commit is contained in:
Brett Meyer 2015-08-20 11:37:35 -04:00
parent 2057bb3f1d
commit 2505f61613
3 changed files with 36 additions and 59 deletions

View File

@ -68,9 +68,10 @@
<para>
Apache Karaf environments tend to make heavy use of its "features" concept, where a feature is a set of order-specific
bundles focused on a concise capability. These features are typically defined in a <literal>features.xml</literal> file.
Hibernate produces and releases its own <literal>features.xml</literal> that defines features for each of the three runtime configurations.
Hibernate produces and releases its own <literal>features.xml</literal> that defines a core <literal>hibernate-orm</literal>,
as well as additional features for optional functionality (caching, Envers, etc.).
This is included in the binary distribution, as well as deployed to the JBoss Nexus repository
(using the <literal>org.hibernate</literal> groupId and <literal>hibernate-osgi</literal> with the <literal>karaf</literal> classifier).
(using the <literal>org.hibernate</literal> groupId and <literal>hibernate-osgi</literal> with the <literal>karaf.xml</literal> classifier).
</para>
<para>
@ -80,8 +81,10 @@
</para>
<para>
Also note that hibernate-osgi, theoretically, supports a variety of OSGi containers, such as Equinox. In that case,
please use features.xml as a reference for necessary bundles to activate and their correct ordering.
hibernate-osgi, theoretically, supports a variety of OSGi containers, such as Equinox. In that case,
please use features.xml as a reference for necessary bundles to activate and their correct ordering. However,
note that Karaf starts a number of bundles automatically, several of which would need to be installed manually
on alternatives.
</para>
</section>
@ -103,6 +106,24 @@
<literal>PersistenceProvider</literal> service.
</para>
<section>
<title>Enterprise OSGi JPA Container</title>
<para>
In order to utilize container-managed JPA, an Enterprise OSGi JPA container must be active in the runtime.
In Karaf, this means Aries JPA, which is included out-of-the-box (simply activate the <literal>jpa</literal>
and <literal>jta</literal> features). Originally, we intended to include those dependencies within our own
<literal>features.xml</literal>. However, after guidance from the Karaf and Aries teams, it was pulled out.
This allows Hibernate OSGi to be portable and not be directly tied to Aries versions, instead having
the user choose which to use.
</para>
<para>
That being said, the QuickStart/Demo projects include a sample
<link xl:href="https://github.com/hibernate/hibernate-demos/tree/master/hibernate-orm/osgi/managed-jpa/features.xml">features.xml</link>
showing which features need activated in Karaf in order to support this environment. As mentioned, use this
purely as a reference!
</para>
</section>
<section>
<title>persistence.xml</title>
<para>
@ -155,16 +176,6 @@
</para>
</section>
<section>
<title>JPA 2.1</title>
<para>
No Enterprise OSGi JPA container currently supports JPA 2.1 (the spec is not yet released). For
testing, the managed-jpa example makes use of
<link xl:href="https://github.com/brmeyer/aries/tree/jpa21">Brett's fork of Aries</link>. To work
with Hibernate 4.3/5.0, clone the fork and build Aries JPA.
</para>
</section>
<section>
<title>Obtaining an EntityManger</title>
<para>
@ -417,14 +428,6 @@
<literal>features.xml</literal> for example sequences.
</para>
</listitem>
<listitem>
<para>
No Enterprise OSGi JPA container currently supports JPA 2.1 (the spec is not yet released). For
testing, the managed-jpa example makes use of
<link xl:href="https://github.com/brmeyer/aries/tree/jpa21">Brett's fork of Aries</link>. To work
with Hibernate 4.3, clone the fork and build Aries JPA.
</para>
</listitem>
</itemizedlist>
</section>

View File

@ -20,9 +20,6 @@ configurations {
description = 'Configuration used to isolate the dependency on the Karaf distro'
transitive = false
}
aries {
description = 'Runtime dependencies for Aries for the hibernate-jpa-aries Karaf feature'
}
hibernateEntityManager {
description = 'Used in Karaf feature generation to define the Hibernate JPA dependencies'
transitive = false
@ -66,9 +63,6 @@ dependencies {
}
karafDistro "org.apache.karaf:apache-karaf:${karafVersion}@tar.gz"
aries 'org.apache.aries.transaction:org.apache.aries.transaction.blueprint:1.0.0'
aries 'org.apache.aries.transaction:org.apache.aries.transaction.manager:1.0.1'
}
mavenPom {
@ -116,9 +110,9 @@ task generateVersionFile {
karafFeatures {
features {
hibernateBase {
name = 'hibernate-base'
description = 'Isolates all Hibernate core dependencies into a single feature'
hibernateOrm {
name = 'hibernate-orm'
description = 'Combines all Hibernate core dependencies and required modules into a single feature'
projects = [
rootProject.childProjects.'hibernate-core',
rootProject.childProjects.'hibernate-entitymanager',
@ -159,31 +153,12 @@ karafFeatures {
remap group: 'org.apache.servicemix.bundles', module: 'org.apache.servicemix.bundles.dom4j', version: '1.6.1_5'
}
}
hibernateNative {
name = 'hibernate-native'
description = 'Defines support for using Hibernate native APIs (SessionFactory, Session) in user applications/bundles'
dependencyFeatureNames = ['hibernate-base']
projects = []
}
hibernateJpa {
name = 'hibernate-jpa'
description = 'Defines support for using Hibernate JPA implementation in user applications/bundles in an unmanaged manner'
dependencyFeatureNames = ['hibernate-base']
projects = []
}
hibernateJpaAries {
name = 'hibernate-jpa-aries'
description = 'Defines support for using Hibernate JPA implementation in user applications/bundles in an managed manner using Aries for OSGi JPA support'
bundleDependencies = [project.configurations.aries]
dependencyFeatureNames = ['hibernate-base']
projects = []
}
// NOTE : would like to include spatial as well, but we need to wait for
// it to not define dependency on postgresql driver
hibernateEnvers {
name = 'hibernate-envers'
description = 'Feature for easily adding Envers support to hibernate-native, hibernate-jpa or hibernate-jpa-aries'
dependencyFeatureNames = ['hibernate-base']
description = 'Feature for easily adding Envers support to hibernate-orm'
dependencyFeatureNames = ['hibernate-orm']
projects = [rootProject.childProjects.'hibernate-envers']
bundle {
match group: 'org.hibernate', module: 'hibernate-core'
@ -212,8 +187,8 @@ karafFeatures {
}
hibernateInfinispan {
name = 'hibernate-infinispan'
description = 'Feature for easily adding Infinispan-based caching support to hibernate-native, hibernate-jpa or hibernate-jpa-aries'
dependencyFeatureNames = ['hibernate-base']
description = 'Feature for easily adding Infinispan-based caching support to hibernate-orm'
dependencyFeatureNames = ['hibernate-orm']
projects = [rootProject.childProjects.'hibernate-infinispan']
bundle {
match group: 'org.hibernate', module: 'hibernate-core'
@ -242,8 +217,8 @@ karafFeatures {
}
hibernateEhcache {
name = 'hibernate-ehcache'
description = 'Feature for easily adding Ehcache-based caching support to hibernate-native, hibernate-jpa or hibernate-jpa-aries'
dependencyFeatureNames = ['hibernate-base']
description = 'Feature for easily adding Ehcache-based caching support to hibernate-orm'
dependencyFeatureNames = ['hibernate-orm']
projects = [rootProject.childProjects.'hibernate-ehcache']
bundle {
match group: 'org.hibernate', module: 'hibernate-core'

View File

@ -111,7 +111,7 @@ public class OsgiIntegrationTest {
configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
when( debug ).useOptions( keepRuntimeFolder() ),
logLevel( LogLevelOption.LogLevel.INFO ),
features( featureXmlUrl( paxExamEnvironment ), "hibernate-native", "hibernate-jpa" ),
features( featureXmlUrl( paxExamEnvironment ), "hibernate-orm" ),
features( testingFeatureXmlUrl(), "hibernate-osgi-testing" )
);
}
@ -191,8 +191,7 @@ public class OsgiIntegrationTest {
@Test
public void testFeatureInstallation() throws Exception {
assertTrue( featuresService.isInstalled( featuresService.getFeature( "hibernate-jpa" ) ) );
assertTrue( featuresService.isInstalled( featuresService.getFeature( "hibernate-native" ) ) );
assertTrue( featuresService.isInstalled( featuresService.getFeature( "hibernate-orm" ) ) );
}
@Test