HHH-8763 osgi quickstart updates

This commit is contained in:
Brett Meyer 2013-12-04 10:12:53 -05:00
parent 3ff64a55c5
commit 7ee5fa104d
8 changed files with 260 additions and 10 deletions

View File

@ -0,0 +1,47 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* JBoss, Home of Professional Open Source
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.hibernate.osgitest;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
/**
* @author Brett Meyer
*/
public class TestIntegrator implements Integrator {
public void integrate(Configuration configuration, 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");
}
}

View File

@ -0,0 +1,37 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* JBoss, Home of Professional Open Source
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.hibernate.osgitest;
import java.util.Collections;
import org.hibernate.boot.registry.selector.StrategyRegistration;
import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
/**
* @author Brett Meyer
*/
public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
public Iterable<StrategyRegistration> getStrategyRegistrations() {
System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
return Collections.EMPTY_LIST;
}
}

View File

@ -0,0 +1,37 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* JBoss, Home of Professional Open Source
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.hibernate.osgitest;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.service.ServiceRegistry;
/**
* @author Brett Meyer
*/
public class TestTypeContributor implements TypeContributor {
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
System.out.println("TypeContributor#contribute");
}
}

View File

@ -24,12 +24,16 @@
<bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
<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"/>
<!-- 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="typeContributor" class="your.package.TypeContributorImpl"/>
<service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/> -->
<bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
<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">

View File

@ -0,0 +1,47 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* JBoss, Home of Professional Open Source
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.hibernate.osgitest;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
/**
* @author Brett Meyer
*/
public class TestIntegrator implements Integrator {
public void integrate(Configuration configuration, 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");
}
}

View File

@ -0,0 +1,37 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* JBoss, Home of Professional Open Source
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.hibernate.osgitest;
import java.util.Collections;
import org.hibernate.boot.registry.selector.StrategyRegistration;
import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
/**
* @author Brett Meyer
*/
public class TestStrategyRegistrationProvider implements StrategyRegistrationProvider {
public Iterable<StrategyRegistration> getStrategyRegistrations() {
System.out.println("StrategyRegistrationProvider#getStrategyRegistrations");
return Collections.EMPTY_LIST;
}
}

View File

@ -0,0 +1,37 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* JBoss, Home of Professional Open Source
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.hibernate.osgitest;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.service.ServiceRegistry;
/**
* @author Brett Meyer
*/
public class TestTypeContributor implements TypeContributor {
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
System.out.println("TypeContributor#contribute");
}
}

View File

@ -24,12 +24,16 @@
<bean id="dpService" class="org.hibernate.osgitest.DataPointServiceImpl"/>
<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"/>
<!-- 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="typeContributor" class="your.package.TypeContributorImpl"/>
<service ref="typeContributor" interface="org.hibernate.metamodel.spi.TypeContributor"/> -->
<bean id="strategyRegistrationProvider" class="org.hibernate.osgitest.TestStrategyRegistrationProvider"/>
<service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
<bean id="typeContributor" class="org.hibernate.osgitest.TestTypeContributor"/>
<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">