HHH-9680 updated OSGi quickstarts, added necessary contracts to Envers blueprint, corrected a few uses of ReflectionManager

This commit is contained in:
Brett Meyer 2015-03-30 15:36:31 -04:00
parent 212f61a24c
commit 410a785dfe
22 changed files with 602 additions and 594 deletions

View File

@ -1,75 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<features>
<feature name="hibernate-test">
<feature>karaf-framework</feature>
<!-- JTA -->
<config name="org.apache.aries.transaction">
aries.transaction.recoverable = true
aries.transaction.timeout = 600
aries.transaction.howl.logFileDir = /tmp/karaf/txlog
aries.transaction.howl.maxLogFiles = 2
aries.transaction.howl.maxBlocksPerFile = 512
aries.transaction.howl.bufferSizeKBytes = 4
</config>
<bundle dependency="true" start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.1</bundle>
<!-- JPA -->
<bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
<!-- No container currently supports JPA 2.1. Clone and build Aries from the following fork (upgrades to
JPA 2.1). Aries should be upgrading as soon as the spec is out.
https://github.com/brmeyer/aries/tree/jpa21 -->
<bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.1.1-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.1-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.2-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.1-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.2-SNAPSHOT</bundle>
<!-- JNDI -->
<bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.api/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.core/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.rmi/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.url/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.legacy.support/1.0.0</bundle>
<!-- Taken from Karaf-Tutorial -->
<bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
<bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
<bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
<bundle>mvn:commons-lang/commons-lang/2.6</bundle>
<bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
<feature name="hibernate-test">
<bundle>mvn:com.h2database/h2/1.3.170</bundle>
<bundle>blueprint:file:/[PATH]/datasource-h2.xml</bundle>
<!-- JTA -->
<config name="org.apache.aries.transaction">
aries.transaction.recoverable = true
aries.transaction.timeout = 600
aries.transaction.howl.logFileDir = /tmp/karaf/txlog
aries.transaction.howl.maxLogFiles = 2
aries.transaction.howl.maxBlocksPerFile = 512
aries.transaction.howl.bufferSizeKBytes = 4
</config>
<bundle dependency="true" start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.1</bundle>
<!-- These do not natively support OSGi, so using 3rd party bundles. -->
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
<bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
<!-- TODO: It seems that the persistence unit bundle needs to be started
before hibernate-osgi. When the BundleActivator is started,
the persistence unit is provided even though managed-jpa
hasn't completely started yet. If that happens, you'll get an "illegal
bundle state" exception. Is there a way for the activator to
watch for bundles with PUs before registering the persistence provider? -->
<bundle>mvn:org.hibernate.osgi/managed-jpa/1.0.0</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
</feature>
<!-- JPA -->
<bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
<!-- No container currently supports JPA 2.1. Clone and build Aries from the following fork (upgrades to
JPA 2.1). Aries should be upgrading as soon as the spec is out.
https://github.com/brmeyer/aries/tree/jpa21 -->
<bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.1.1-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.1-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.2-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.1-SNAPSHOT</bundle>
<bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.2-SNAPSHOT</bundle>
<!-- JNDI -->
<bundle start-level="30">mvn:org.apache.aries/org.apache.aries.util/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.api/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.core/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.rmi/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.url/1.0.0</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.legacy.support/1.0.0</bundle>
<!-- Taken from Karaf-Tutorial -->
<bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
<bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
<bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
<bundle>mvn:commons-lang/commons-lang/2.6</bundle>
<bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
<bundle>mvn:com.h2database/h2/1.3.170</bundle>
<bundle>blueprint:file:/[PATH]/datasource-h2.xml</bundle>
<!-- These do not natively support OSGi, so using 3rd party bundles. -->
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
<bundle>mvn:org.hibernate/hibernate-core/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/5.0.0-SNAPSHOT</bundle>
<!-- TODO: It seems that the persistence unit bundle needs to be started
before hibernate-osgi. When the BundleActivator is started,
the persistence unit is provided even though managed-jpa
hasn't completely started yet. If that happens, you'll get an "illegal
bundle state" exception. Is there a way for the activator to
watch for bundles with PUs before registering the persistence provider? -->
<bundle>mvn:org.hibernate.osgi/managed-jpa/1.0.0</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/5.0.0-SNAPSHOT</bundle>
</feature>
</features>

View File

@ -1,64 +1,64 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate.osgi</groupId>
<artifactId>managed-jpa</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate.osgi</groupId>
<artifactId>managed-jpa</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.hibernate.osgi.managed-jpa</Bundle-SymbolicName>
<Bundle-Name>managed-jpa</Bundle-Name>
<Bundle-Version>1.0.0</Bundle-Version>
<Export-Package>
org.hibernate.osgitest,
org.hibernate.osgitest.entity
</Export-Package>
<Import-Package>
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
org.apache.karaf.shell.commands,
javax.persistence;version="[1.0.0,2.1.0]",
<!-- Needed for proxying's Javassist enhancement during runtime -->
org.hibernate.proxy,
javassist.util.proxy,
*
</Import-Package>
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.hibernate.osgi.managed-jpa</Bundle-SymbolicName>
<Bundle-Name>managed-jpa</Bundle-Name>
<Bundle-Version>1.0.0</Bundle-Version>
<Export-Package>
org.hibernate.osgitest,
org.hibernate.osgitest.entity
</Export-Package>
<Import-Package>
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
org.apache.karaf.shell.commands,
javax.persistence;version="[1.0.0,2.1.0]",
<!-- Needed for proxying's Javassist enhancement during runtime -->
org.hibernate.proxy,
javassist.util.proxy,
*
</Import-Package>
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -17,42 +17,42 @@
limitations under the License.
-->
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
<!-- This gets the container-managed EntityManager and injects it into the DataPointServiceImpl bean. -->
<bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl">
<jpa:context unitname="managed-jpa" property="entityManager"/>
<tx:transaction method="*" value="Required"/>
<bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl">
<jpa:context unitname="managed-jpa" property="entityManager"/>
<tx:transaction method="*" value="Required"/>
</bean>
<service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
<service ref="dpService" interface="org.hibernate.osgitest.DataPointService"/>
<!-- This demonstrates how to register your custom implementations of Hibernate extension points, such as
Integrator and TypeContributor. -->
<!-- <bean id="integrator" class="your.package.IntegratorImpl"/>
<service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
<bean id="typeContributor" class="your.package.TypeContributorImpl"/>
<service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/> -->
<!-- This bundle makes use of Karaf commands to demonstrate core persistence operations. Feel free to remove it. -->
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command name="dp/add">
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp/getAll">
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp/deleteAll">
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
</command-bundle>
<command>
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
</command-bundle>
</blueprint>

View File

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<features>
<feature name="hibernate-test">
<feature>karaf-framework</feature>
<!-- JTA -->
<bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<!-- JPA -->
<bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
<!-- Taken from Karaf-Tutorial -->
<bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
<bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
<bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
<bundle>mvn:commons-lang/commons-lang/2.6</bundle>
<bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
<feature name="hibernate-test">
<bundle>mvn:com.h2database/h2/1.3.170</bundle>
<!-- JTA -->
<bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<!-- These do not natively support OSGi, so using 3rd party bundles. -->
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
<bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate.osgi/unmanaged-jpa/1.0.0</bundle>
</feature>
<!-- JPA -->
<bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
<!-- Taken from Karaf-Tutorial -->
<bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
<bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
<bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
<bundle>mvn:commons-lang/commons-lang/2.6</bundle>
<bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
<bundle>mvn:com.h2database/h2/1.3.170</bundle>
<!-- These do not natively support OSGi, so using 3rd party bundles. -->
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
<bundle>mvn:org.hibernate/hibernate-core/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-entitymanager/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-osgi/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate.osgi/unmanaged-jpa/1.0.0</bundle>
</feature>
</features>

View File

@ -1,75 +1,75 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate.osgi</groupId>
<artifactId>unmanaged-jpa</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate.osgi</groupId>
<artifactId>unmanaged-jpa</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.170</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.170</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.hibernate.osgi.unmanaged-jpa</Bundle-SymbolicName>
<Bundle-Name>unmanaged-jpa</Bundle-Name>
<Bundle-Version>1.0.0</Bundle-Version>
<Export-Package>
org.hibernate.osgitest,
org.hibernate.osgitest.entity
</Export-Package>
<Import-Package>
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
org.apache.karaf.shell.commands,
org.h2,
javax.persistence;version="[1.0.0,2.1.0]",
<!-- Needed for proxying's Javassist enhancement during runtime -->
org.hibernate.proxy,
javassist.util.proxy,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.hibernate.osgi.unmanaged-jpa</Bundle-SymbolicName>
<Bundle-Name>unmanaged-jpa</Bundle-Name>
<Bundle-Version>1.0.0</Bundle-Version>
<Export-Package>
org.hibernate.osgitest,
org.hibernate.osgitest.entity
</Export-Package>
<Import-Package>
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
org.apache.karaf.shell.commands,
org.h2,
javax.persistence;version="[1.0.0,2.1.0]",
<!-- Needed for proxying's Javassist enhancement during runtime -->
org.hibernate.proxy,
javassist.util.proxy,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -20,10 +20,9 @@
*/
package org.hibernate.osgitest;
import org.hibernate.cfg.Configuration;
import org.hibernate.boot.Metadata;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
@ -32,16 +31,15 @@ import org.hibernate.service.spi.SessionFactoryServiceRegistry;
*/
public class TestIntegrator implements Integrator {
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#disintegrate");
}
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#disintegrate");
}
}

View File

@ -20,8 +20,8 @@
*/
package org.hibernate.osgitest;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.boot.model.TypeContributor;
import org.hibernate.service.ServiceRegistry;
@ -30,8 +30,8 @@ import org.hibernate.service.ServiceRegistry;
*/
public class TestTypeContributor implements TypeContributor {
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
System.out.println("TypeContributor#contribute");
}
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
System.out.println("TypeContributor#contribute");
}
}

View File

@ -17,45 +17,46 @@
limitations under the License.
-->
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
<service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
<service ref="dpService" interface="org.hibernate.osgitest.DataPointService"/>
<!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
<bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
<service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
<bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider"
interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
<service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
<!-- This bundle makes use of Karaf commands to demonstrate core persistence operations. Feel free to remove it. -->
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command name="dp:add">
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:update">
<action class="org.hibernate.osgitest.command.UpdateCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:getAll">
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:deleteAll">
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
</command-bundle>
<command>
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.UpdateCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
</command-bundle>
</blueprint>

View File

@ -1,71 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<features>
<feature name="hibernate-test">
<feature>karaf-framework</feature>
<!-- JTA -->
<bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<!-- JPA -->
<bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
<!-- Taken from Karaf-Tutorial -->
<bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
<bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
<bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
<bundle>mvn:commons-lang/commons-lang/2.6</bundle>
<bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
<feature name="hibernate-test">
<bundle>mvn:com.h2database/h2/1.3.170</bundle>
<!--<feature>karaf-framework</feature>-->
<!-- These do not natively support OSGi, so using 3rd party bundles. -->
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Alpha1</bundle>
<!-- Optional. Needed to test C3P0 connection pools. -->
<!-- <bundle>wrap:mvn:c3p0/c3p0/0.9.1</bundle> -->
<!-- Optional. Needed to test Proxool connection pools. -->
<!-- <bundle>wrap:mvn:proxool/proxool/0.8.3</bundle> -->
<!-- Optional. Needed to test ehcache 2lc. -->
<!-- <bundle>wrap:mvn:net.sf.ehcache/ehcache-core/2.4.3</bundle> -->
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.3.Final</bundle>
<!-- JACC is optional. -->
<!--<bundle>mvn:javax.servlet/javax.servlet-api/3.0.1</bundle>
<bundle>mvn:org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.4_spec/1.0.2.Final</bundle>-->
<!-- hibernate-validator is optional. -->
<!--<bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA</bundle>
<bundle>mvn:org.hibernate/hibernate-validator/4.2.0.Final</bundle>-->
<!-- Optional. Needed to test infinispan 2lc. -->
<!-- IMPORTANT: Infinispan requires the JRE sun.misc package. You
MUST enable this in your OSGi container. For Karaf, add
"org.osgi.framework.system.packages.extra=sun.misc" to etc/config.properties -->
<!-- <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling/1.3.17.GA</bundle>
<bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling-river/1.3.17.GA</bundle>
<bundle>wrap:mvn:org.jboss/staxmapper/1.1.0.Final</bundle>
<bundle>mvn:org.jgroups/jgroups/3.2.8.Final</bundle>
<bundle>mvn:org.infinispan/infinispan-core/5.2.0.Beta3</bundle> -->
<!-- JTA -->
<bundle start-level="30">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
<bundle>mvn:org.hibernate/hibernate-core/4.3.0-SNAPSHOT</bundle>
<!-- TODO: Shouldn't need this, but hibernate-osgi's activator is a catch-all for SF and EMF. -->
<bundle>mvn:org.hibernate/hibernate-entitymanager/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-envers/4.3.0-SNAPSHOT</bundle>
<!-- <bundle>mvn:org.hibernate/hibernate-c3p0/4.3.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-proxool/4.3.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-ehcache/4.3.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-infinispan/4.3.0-SNAPSHOT</bundle> -->
<bundle>mvn:org.hibernate/hibernate-osgi/4.3.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate.osgi/unmanaged-native/1.0.0</bundle>
</feature>
<!-- JPA -->
<bundle start-level="30">mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final</bundle>
<!-- Taken from Karaf-Tutorial -->
<bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
<bundle>mvn:commons-pool/commons-pool/1.5.4</bundle>
<bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
<bundle>mvn:commons-lang/commons-lang/2.6</bundle>
<bundle>wrap:mvn:net.sourceforge.serp/serp/1.13.1</bundle>
<bundle>mvn:com.h2database/h2/1.3.170</bundle>
<!-- These do not natively support OSGi, so using 3rd party bundles. -->
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<!-- These do not natively support OSGi, so wrap with BND. -->
<bundle>wrap:mvn:org.jboss/jandex/1.1.0.Final</bundle>
<!-- Optional. Needed to test C3P0 connection pools. -->
<!-- <bundle>wrap:mvn:c3p0/c3p0/0.9.1</bundle> -->
<!-- Optional. Needed to test Proxool connection pools. -->
<!-- <bundle>wrap:mvn:proxool/proxool/0.8.3</bundle> -->
<!-- Optional. Needed to test ehcache 2lc. -->
<!-- <bundle>wrap:mvn:net.sf.ehcache/ehcache-core/2.4.3</bundle> -->
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
<!-- JACC is optional. -->
<!--<bundle>mvn:javax.servlet/javax.servlet-api/3.0.1</bundle>
<bundle>mvn:org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.4_spec/1.0.2.Final</bundle>-->
<!-- hibernate-validator is optional. -->
<!--<bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA</bundle>
<bundle>mvn:org.hibernate/hibernate-validator/4.2.0.Final</bundle>-->
<!-- Optional. Needed to test infinispan 2lc. -->
<!-- IMPORTANT: Infinispan requires the JRE sun.misc package. You
MUST enable this in your OSGi container. For Karaf, add
"org.osgi.framework.system.packages.extra=sun.misc" to etc/config.properties -->
<!-- <bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling/1.3.17.GA</bundle>
<bundle>wrap:mvn:org.jboss.marshalling/jboss-marshalling-river/1.3.17.GA</bundle>
<bundle>wrap:mvn:org.jboss/staxmapper/1.1.0.Final</bundle>
<bundle>mvn:org.jgroups/jgroups/3.2.8.Final</bundle>
<bundle>mvn:org.infinispan/infinispan-core/5.2.0.Beta3</bundle> -->
<bundle>mvn:org.hibernate/hibernate-core/5.0.0-SNAPSHOT</bundle>
<!-- TODO: Shouldn't need this, but hibernate-osgi's activator is a catch-all for SF and EMF. -->
<bundle>mvn:org.hibernate/hibernate-entitymanager/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate/hibernate-envers/5.0.0-SNAPSHOT</bundle>
<!-- <bundle>mvn:org.hibernate/hibernate-c3p0/5.0.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-proxool/5.0.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-ehcache/5.0.0-SNAPSHOT</bundle> -->
<!-- <bundle>mvn:org.hibernate/hibernate-infinispan/5.0.0-SNAPSHOT</bundle> -->
<bundle>mvn:org.hibernate/hibernate-osgi/5.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.hibernate.osgi/unmanaged-native/1.0.0</bundle>
</feature>
</features>

View File

@ -1,83 +1,83 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate.osgi</groupId>
<artifactId>unmanaged-native</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate.osgi</groupId>
<artifactId>unmanaged-native</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>4.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.170</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.170</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.hibernate.osgi.unmanaged-native</Bundle-SymbolicName>
<Bundle-Name>unmanaged-native</Bundle-Name>
<Bundle-Version>1.0.0</Bundle-Version>
<Export-Package>
org.hibernate.osgitest,
org.hibernate.osgitest.entity
</Export-Package>
<Import-Package>
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
org.apache.karaf.shell.commands,
org.h2,
org.hibernate,
org.hibernate.cfg,
org.hibernate.service,
javax.persistence;version="[1.0.0,2.1.0]",
<!-- Needed for proxying's Javassist enhancement during runtime -->
org.hibernate.proxy,
javassist.util.proxy,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.hibernate.osgi.unmanaged-native</Bundle-SymbolicName>
<Bundle-Name>unmanaged-native</Bundle-Name>
<Bundle-Version>1.0.0</Bundle-Version>
<Export-Package>
org.hibernate.osgitest,
org.hibernate.osgitest.entity
</Export-Package>
<Import-Package>
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
org.apache.karaf.shell.commands,
org.h2,
org.hibernate,
org.hibernate.cfg,
org.hibernate.service,
javax.persistence;version="[1.0.0,2.1.0]",
<!-- Needed for proxying's Javassist enhancement during runtime -->
org.hibernate.proxy,
javassist.util.proxy,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -20,11 +20,6 @@
*/
package org.hibernate.osgitest;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.hibernate.envers.AuditReader;
@ -32,6 +27,10 @@ import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.envers.DefaultRevisionEntity;
import org.hibernate.osgitest.entity.DataPoint;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
/**
* @author Brett Meyer
*/

View File

@ -20,10 +20,9 @@
*/
package org.hibernate.osgitest;
import org.hibernate.cfg.Configuration;
import org.hibernate.boot.Metadata;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
@ -32,16 +31,15 @@ import org.hibernate.service.spi.SessionFactoryServiceRegistry;
*/
public class TestIntegrator implements Integrator {
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#disintegrate");
}
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#disintegrate");
}
}

View File

@ -20,8 +20,8 @@
*/
package org.hibernate.osgitest;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.boot.model.TypeContributor;
import org.hibernate.service.ServiceRegistry;

View File

@ -17,60 +17,61 @@
limitations under the License.
-->
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
<service ref="dpService" interface="org.hibernate.osgitest.DataPointService" />
<service ref="dpService" interface="org.hibernate.osgitest.DataPointService"/>
<!-- This demonstrates how to register your custom implementations of Hibernate extension points. -->
<bean id="integrator" class="org.hibernate.osgitest.TestIntegrator"/>
<service ref="integrator" interface="org.hibernate.integrator.spi.Integrator"/>
<bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider"
interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
<service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
<!-- This bundle makes use of Karaf commands to demonstrate core persistence operations. Feel free to remove it. -->
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command name="dp:add">
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:update">
<action class="org.hibernate.osgitest.command.UpdateCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:get">
<action class="org.hibernate.osgitest.command.GetCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:load">
<action class="org.hibernate.osgitest.command.LoadCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:getAll">
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:getRevisions">
<action class="org.hibernate.osgitest.command.GetRevisionsCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command name="dp:deleteAll">
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
</command-bundle>
<command>
<action class="org.hibernate.osgitest.command.AddCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.UpdateCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.GetCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.LoadCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.GetAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.GetRevisionsCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
<command>
<action class="org.hibernate.osgitest.command.DeleteAllCommand">
<property name="dpService" ref="dpService"/>
</action>
</command>
</command-bundle>
</blueprint>

View File

@ -23,16 +23,9 @@
*/
package org.hibernate.boot.model.source.internal.annotations;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import javax.persistence.Entity;
import org.dom4j.Document;
import org.hibernate.AnnotationException;
import org.hibernate.annotations.common.reflection.ClassLoadingException;
import org.hibernate.annotations.common.reflection.MetadataProviderInjector;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
@ -50,11 +43,17 @@ import org.hibernate.cfg.annotations.reflection.AttributeConverterDefinitionColl
import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.jboss.jandex.IndexView;
import org.jboss.logging.Logger;
import org.dom4j.Document;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import javax.persistence.Entity;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Steve Ebersole
@ -143,9 +142,9 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
@SuppressWarnings("deprecation")
private XClass toXClass(String className, ReflectionManager reflectionManager) {
try {
return reflectionManager.classForName( className, this.getClass() );
return reflectionManager.classForName( className );
}
catch ( ClassNotFoundException e ) {
catch ( ClassLoadingException e ) {
throw new AnnotationException( "Unable to load class defined in XML: " + className, e );
}
}

View File

@ -23,17 +23,6 @@
*/
package org.hibernate.cfg;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.MappingException;
@ -41,6 +30,7 @@ import org.hibernate.annotations.AnyMetaDef;
import org.hibernate.annotations.AnyMetaDefs;
import org.hibernate.annotations.MetaValue;
import org.hibernate.annotations.SqlFragmentAlias;
import org.hibernate.annotations.common.reflection.ClassLoadingException;
import org.hibernate.annotations.common.reflection.XAnnotatedElement;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XPackage;
@ -66,9 +56,19 @@ import org.hibernate.mapping.SyntheticProperty;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.jboss.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
/**
* @author Emmanuel Bernard
*/
@ -859,9 +859,9 @@ public class BinderHelper {
final XClass persistentXClass;
try {
persistentXClass = buildingContext.getBuildingOptions().getReflectionManager()
.classForName( propertyHolder.getPersistentClass().getClassName(), AnnotationBinder.class );
.classForName( propertyHolder.getPersistentClass().getClassName() );
}
catch ( ClassNotFoundException e ) {
catch ( ClassLoadingException e ) {
throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e);
}
if ( propertyHolder.isInIdClass() ) {

View File

@ -23,19 +23,12 @@
*/
package org.hibernate.cfg.annotations;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.MapKeyClass;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
import org.hibernate.annotations.MapKeyType;
import org.hibernate.annotations.common.reflection.ClassLoadingException;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.boot.spi.MetadataBuildingContext;
@ -68,6 +61,14 @@ import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.hibernate.sql.Template;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.MapKeyClass;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
/**
* Implementation to bind a Map
*
@ -185,9 +186,9 @@ public class MapBinder extends CollectionBinder {
}
else {
try {
keyXClass = buildingContext.getBuildingOptions().getReflectionManager().classForName( mapKeyType, MapBinder.class );
keyXClass = buildingContext.getBuildingOptions().getReflectionManager().classForName( mapKeyType );
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new AnnotationException( "Unable to find class: " + mapKeyType, e );
}
classType = buildingContext.getMetadataCollector().getClassType( keyXClass );

View File

@ -23,27 +23,27 @@
*/
package org.hibernate.jpa.event.internal.jpa;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ClassLoadingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMethod;
import org.hibernate.jpa.event.spi.jpa.Callback;
import org.hibernate.jpa.event.spi.jpa.ListenerFactory;
import org.jboss.logging.Logger;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.ExcludeDefaultListeners;
import javax.persistence.ExcludeSuperclassListeners;
import javax.persistence.MappedSuperclass;
import javax.persistence.PersistenceException;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMethod;
import org.hibernate.jpa.event.spi.jpa.Callback;
import org.hibernate.jpa.event.spi.jpa.ListenerFactory;
import org.jboss.logging.Logger;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
@ -64,14 +64,14 @@ public class LegacyCallbackProcessor implements CallbackProcessor {
public void processCallbacksForEntity(Object entityObject, CallbackRegistryImpl callbackRegistry) {
final String entityClassName = (String) entityObject;
try {
final XClass entityXClass = reflectionManager.classForName( entityClassName, this.getClass() );
final XClass entityXClass = reflectionManager.classForName( entityClassName );
final Class entityClass = reflectionManager.toClass( entityXClass );
for ( Class annotationClass : CALLBACK_ANNOTATION_CLASSES ) {
final Callback[] callbacks = resolveCallbacks( entityXClass, annotationClass, reflectionManager );
callbackRegistry.addEntityCallbacks( entityClass, annotationClass, callbacks );
}
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new MappingException( "entity class not found: " + entityClassName, e );
}
}

View File

@ -26,6 +26,7 @@ package org.hibernate.envers.configuration.internal;
import org.dom4j.Document;
import org.dom4j.Element;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ClassLoadingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XProperty;
@ -319,9 +320,9 @@ public class RevisionInfoConfiguration {
if (persistentClass.getClassName() != null) {
XClass clazz;
try {
clazz = reflectionManager.classForName( persistentClass.getClassName(), this.getClass() );
clazz = reflectionManager.classForName( persistentClass.getClassName() );
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new MappingException( e );
}

View File

@ -23,10 +23,8 @@
*/
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.lang.annotation.Annotation;
import java.util.Iterator;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ClassLoadingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.envers.AuditTable;
@ -38,6 +36,9 @@ import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import java.lang.annotation.Annotation;
import java.util.Iterator;
/**
* A helper class to read versioning meta-data from annotations on a persistent class.
*
@ -113,7 +114,7 @@ public final class AnnotationsMetadataReader {
}
try {
final XClass xclass = reflectionManager.classForName( pc.getClassName(), this.getClass() );
final XClass xclass = reflectionManager.classForName( pc.getClassName() );
final ModificationStore defaultStore = getDefaultAudited( xclass );
if ( defaultStore != null ) {
@ -132,7 +133,7 @@ public final class AnnotationsMetadataReader {
addAuditTable( xclass );
addAuditSecondaryTables( xclass );
}
catch (ClassNotFoundException e) {
catch (ClassLoadingException e) {
throw new MappingException( e );
}

View File

@ -23,19 +23,8 @@
*/
package org.hibernate.envers.configuration.internal.metadata.reader;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.JoinColumn;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.ClassLoadingException;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XProperty;
@ -57,6 +46,18 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
import javax.persistence.JoinColumn;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.hibernate.envers.internal.tools.Tools.newHashMap;
import static org.hibernate.envers.internal.tools.Tools.newHashSet;
@ -732,9 +733,9 @@ public class AuditedPropertiesReader {
public ComponentPropertiesSource(ReflectionManager reflectionManager, Component component) {
try {
this.xclass = reflectionManager.classForName( component.getComponentClassName(), this.getClass() );
this.xclass = reflectionManager.classForName( component.getComponentClassName() );
}
catch ( ClassNotFoundException e ) {
catch ( ClassLoadingException e ) {
throw new MappingException( e );
}

View File

@ -9,5 +9,11 @@
<bean id="typeContributor" class="org.hibernate.envers.boot.internal.TypeContributorImpl"/>
<service ref="typeContributor" interface="org.hibernate.boot.model.TypeContributor"/>
<bean id="serviceContributor" class="org.hibernate.envers.boot.internal.EnversServiceContributor"/>
<service ref="serviceContributor" interface="org.hibernate.service.spi.ServiceContributor"/>
<bean id="additionalJaxbMappingProducer" class="org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl"/>
<service ref="additionalJaxbMappingProducer" interface="org.hibernate.boot.spi.AdditionalJaxbMappingProducer"/>
</blueprint>