/** * Returns the Compass Gps instance associated with the given OpenJPA {@link javax.persistence.EntityManagerFactory}. * Used in order to perform {@link org.compass.gps.device.jpa.embedded.JpaCompassGps#index()} operation. Note, the index * operation should not be perfomed within a running transaction. */ public static JpaCompassGps getCompassGps(EntityManagerFactory emf) { EntityManagerFactory nativeEmf = NativeJpaHelper.extractNativeJpa(emf); OpenJPAEntityManagerFactory openJpaEmf = OpenJPAPersistence.cast(nativeEmf); return (JpaCompassGps) openJpaEmf.getUserObject(CompassProductDerivation.COMPASS_GPS_USER_OBJECT_KEY); }
/** * Returns the Compass instance assoicated with the given OpenJPA {@link javax.persistence.EntityManagerFactory}. * This allows to get a Compass instnace in order to perform search operations for example outside of a JPA * transaction (for performance reasons, mostly there is no need to start a DB transaction). */ public static Compass getCompass(EntityManagerFactory emf) { EntityManagerFactory nativeEmf = NativeJpaHelper.extractNativeJpa(emf); OpenJPAEntityManagerFactory openJpaEmf = OpenJPAPersistence.cast(nativeEmf); return (Compass) openJpaEmf.getUserObject(CompassProductDerivation.COMPASS_USER_OBJECT_KEY); }
/** * Returns the index settings that are configured within the {@link javax.persistence.EntityManagerFactory} * configuration. Can be used to configure exteranally a {@link org.compass.gps.device.jpa.embedded.JpaCompassGps} * instance. */ public Properties getIndexSettings(EntityManagerFactory emf) { EntityManagerFactory nativeEmf = NativeJpaHelper.extractNativeJpa(emf); OpenJPAEntityManagerFactory openJpaEmf = OpenJPAPersistence.cast(nativeEmf); return (Properties) openJpaEmf.getUserObject(CompassProductDerivation.COMPASS_INDEX_SETTINGS_USER_OBJECT_KEY); }
/** * Returns the Compass Gps instance associated with the given OpenJPA {@link javax.persistence.EntityManager}. * Used in order to perform {@link org.compass.gps.device.jpa.embedded.JpaCompassGps#index()} operation. Note, the index * operation should not be perfomed within a running transaction. */ public static JpaCompassGps getCompassGps(EntityManager em) { EntityManager nativeEm = NativeJpaHelper.extractNativeJpa(em); OpenJPAEntityManagerFactory openJpaEmf = OpenJPAPersistence.cast(nativeEm).getEntityManagerFactory(); return (JpaCompassGps) openJpaEmf.getUserObject(CompassProductDerivation.COMPASS_GPS_USER_OBJECT_KEY); }
/** * Returns the Compass instance assoicated with the given OpenJPA {@link javax.persistence.EntityManager}. * This allows to get a Compass instnace in order to perform search operations for example outside of a JPA * transaction (for performance reasons, mostly there is no need to start a DB transaction). */ public static Compass getCompass(EntityManager em) { EntityManager nativeEm = NativeJpaHelper.extractNativeJpa(em); OpenJPAEntityManagerFactory openJpaEmf = OpenJPAPersistence.cast(nativeEm).getEntityManagerFactory(); return (Compass) openJpaEmf.getUserObject(CompassProductDerivation.COMPASS_USER_OBJECT_KEY); }
/** * Return the underlying broker factory for the given persistence manager * factory facade. */ public static BrokerFactory toBrokerFactory(EntityManagerFactory emf) { if (emf == null) return null; if (!(emf instanceof EntityManagerFactoryImpl)) { Class c = emf.getClass(); try { // either cast here may fail emf = (EntityManagerFactoryImpl) ((OpenJPAEntityManagerFactory) emf).getUserObject(EMF_KEY); } catch (ClassCastException cce) { throw new ArgumentException(_loc.get( "cant-convert-brokerfactory", c), null, null, false); } } return ((EntityManagerFactoryImpl) emf).getBrokerFactory(); }
/** * Return the underlying broker factory for the given persistence manager * factory facade. */ public static BrokerFactory toBrokerFactory(EntityManagerFactory emf) { if (emf == null) return null; if (!(emf instanceof EntityManagerFactoryImpl)) { Class c = emf.getClass(); try { // either cast here may fail emf = (EntityManagerFactoryImpl) ((OpenJPAEntityManagerFactory) emf).getUserObject(EMF_KEY); } catch (ClassCastException cce) { throw new ArgumentException(_loc.get( "cant-convert-brokerfactory", c), null, null, false); } } return ((EntityManagerFactoryImpl) emf).getBrokerFactory(); }
/** * Return the underlying broker factory for the given persistence manager * factory facade. */ public static BrokerFactory toBrokerFactory(EntityManagerFactory emf) { if (emf == null) return null; if (!(emf instanceof EntityManagerFactoryImpl)) { Class c = emf.getClass(); try { // either cast here may fail emf = (EntityManagerFactoryImpl) ((OpenJPAEntityManagerFactory) emf).getUserObject(EMF_KEY); } catch (ClassCastException cce) { throw new ArgumentException(_loc.get( "cant-convert-brokerfactory", c), null, null, false); } } return ((EntityManagerFactoryImpl) emf).getBrokerFactory(); }
/** * Returns the index settings that are configured within the {@link javax.persistence.EntityManager} * configuration. Can be used to configure exteranally a {@link org.compass.gps.device.jpa.embedded.JpaCompassGps} * instnace. */ public Properties getIndexSettings(EntityManager em) { EntityManager nativeEm = NativeJpaHelper.extractNativeJpa(em); OpenJPAEntityManagerFactory openJpaEmf = OpenJPAPersistence.cast(nativeEm).getEntityManagerFactory(); return (Properties) openJpaEmf.getUserObject(CompassProductDerivation.COMPASS_INDEX_SETTINGS_USER_OBJECT_KEY); } }
/** * Return the underlying broker factory for the given persistence manager * factory facade. */ public static BrokerFactory toBrokerFactory(EntityManagerFactory emf) { if (emf == null) return null; if (!(emf instanceof EntityManagerFactoryImpl)) { Class c = emf.getClass(); try { // either cast here may fail emf = (EntityManagerFactoryImpl) ((OpenJPAEntityManagerFactory) emf).getUserObject(EMF_KEY); } catch (ClassCastException cce) { throw new ArgumentException(_loc.get( "cant-convert-brokerfactory", c), null, null, false); } } return ((EntityManagerFactoryImpl) emf).getBrokerFactory(); }
/** * Return the underlying broker factory for the given persistence manager * factory facade. */ public static BrokerFactory toBrokerFactory(EntityManagerFactory emf) { if (emf == null) return null; if (!(emf instanceof EntityManagerFactoryImpl)) { Class c = emf.getClass(); try { // either cast here may fail emf = (EntityManagerFactoryImpl) ((OpenJPAEntityManagerFactory) emf).getUserObject(EMF_KEY); } catch (ClassCastException cce) { throw new ArgumentException(_loc.get( "cant-convert-brokerfactory", c), null, null, false); } } return ((EntityManagerFactoryImpl) emf).getBrokerFactory(); }