Class OsgiSessionFactoryService

  • All Implemented Interfaces:
    org.osgi.framework.ServiceFactory

    public class OsgiSessionFactoryService
    extends java.lang.Object
    implements org.osgi.framework.ServiceFactory
    Hibernate 4.2 and 4.3 still heavily rely on TCCL for ClassLoading. Although our ClassLoaderService removed some of the reliance, access to the proper ClassLoader via TCCL is still required in a few cases where we call out to external libs. An OSGi bundle manually creating a SessionFactory would require numerous ClassLoader tricks (or may be impossible altogether).

    In order to fully control the TCCL issues and shield users from the knowledge, we're requiring that bundles use this OSGi ServiceFactory. It configures and provides a SessionFactory as an OSGi service.

    Note that an OSGi ServiceFactory differs from a Service. The ServiceFactory allows individual instances of Services to be created and provided to multiple client Bundles.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getService​(org.osgi.framework.Bundle requestingBundle, org.osgi.framework.ServiceRegistration registration)  
      void ungetService​(org.osgi.framework.Bundle requestingBundle, org.osgi.framework.ServiceRegistration registration, java.lang.Object service)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OsgiSessionFactoryService

        public OsgiSessionFactoryService​(OsgiJtaPlatform osgiJtaPlatform,
                                         OsgiServiceUtil osgiServiceUtil)
        Constructs a OsgiSessionFactoryService
        Parameters:
        osgiJtaPlatform - The OSGi-specific JtaPlatform created in HibernateBundleActivator
        osgiServiceUtil - Util object built in HibernateBundleActivator
    • Method Detail

      • getService

        public java.lang.Object getService​(org.osgi.framework.Bundle requestingBundle,
                                           org.osgi.framework.ServiceRegistration registration)
        Specified by:
        getService in interface org.osgi.framework.ServiceFactory
      • ungetService

        public void ungetService​(org.osgi.framework.Bundle requestingBundle,
                                 org.osgi.framework.ServiceRegistration registration,
                                 java.lang.Object service)
        Specified by:
        ungetService in interface org.osgi.framework.ServiceFactory