Examples of BrokerFactory


Examples of org.apache.openjpa.kernel.BrokerFactory

   
    protected boolean findPersistenceUnit() {
        // START - ALLOW PRINT STATEMENTS
        if (_emf == null) {
            System.err.println("Discovering auxiliary Persistent Unit  " + _unit);
            BrokerFactory bf = AbstractBrokerFactory.getPooledFactoryForKey(_unit);
            if (bf != null) {
                _emf = (OpenJPAEntityManagerFactory)bf.getUserObject(JPAFacadeHelper.EMF_KEY);
            }
            System.err.println("Discovered auxiliary Persistent Unit  " + _unit + ":" + _emf);
        }
        // STOP - ALLOW PRINT STATEMENTS
        return _emf != null;
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

            em.close();
        }
    }
   
    public void testDataCacheOneOneSetsIntermediate() {
        BrokerFactory factory = getBrokerFactory(new String[]{
            "openjpa.DataCache", "true",
            "openjpa.RemoteCommitProvider", "sjvm",
        });
       
        // get obj into cache
        Broker broker = factory.newBroker();
        try {
            broker.find(_pc, true, null);
        } finally {
            broker.close();
        }
       
        // test from cache
        broker = factory.newBroker();
        try {
            oneOneIntermediateTest(broker);
        } finally {
            broker.close();
            try {
                factory.close();
            } catch (Exception e) {
            }
        }
    }
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

            Object poolValue = Configurations.removeProperty(EMF_POOL, m);
            ConfigurationProvider cp = pd.load(resource, name, m);
            if (cp == null)
                return null;

            BrokerFactory factory = getBrokerFactory(cp, poolValue, null);
            preloadMetaDataRepository(factory);
           
            return JPAFacadeHelper.toEntityManagerFactory(factory);
        } catch (Exception e) {
            throw PersistenceExceptions.toPersistenceException(e);
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

                cp.getProperties())) {
                cp.addProperty("openjpa." + BrokerValue.KEY,
                    getDefaultBrokerAlias());
            }

            BrokerFactory factory = getBrokerFactory(cp, poolValue,
                pui.getClassLoader());
            if (transformerException != null) {
                Log log = factory.getConfiguration().getLog(
                    OpenJPAConfiguration.LOG_RUNTIME);
                if (log.isTraceEnabled()) {
                    log.warn(
                        _loc.get("transformer-registration-error-ex", pui),
                        transformerException);
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

        try {
            ConfigurationProvider cp = pd.load(resource, name, m);
            if (cp == null)
                return null;

            BrokerFactory factory = Bootstrap.newBrokerFactory(cp, null);
            return JPAFacadeHelper.toEntityManagerFactory(factory);
        } catch (Exception e) {
            throw PersistenceExceptions.toPersistenceException(e);
        }
    }
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

                cp.getProperties())) {
                cp.addProperty("openjpa." + BrokerValue.KEY,
                    BrokerValue.NON_FINALIZING_ALIAS);
            }

            BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
                pui.getClassLoader());
            if (transformerException != null) {
                Log log = factory.getConfiguration().getLog(
                    OpenJPAConfiguration.LOG_RUNTIME);
                if (log.isTraceEnabled()) {
                    log.warn(
                        _loc.get("transformer-registration-error-ex", pui),
                        transformerException);
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

            ConfigurationProvider cp = pd.load(resource, name, m);
            if (cp == null) {
                return null;
            }

            BrokerFactory factory = getBrokerFactory(cp, poolValue, BundleUtils.getBundleClassLoader());
            OpenJPAConfiguration conf = factory.getConfiguration();
            _log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);           
            pd.checkPuNameCollisions(_log,name);
           
            // add enhancer
            loadAgent(factory);
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

            if (!Configurations.containsProperty(BrokerValue.KEY, cp.getProperties())) {
                cp.addProperty("openjpa." + BrokerValue.KEY, getDefaultBrokerAlias());
            }

            // OPENJPA-1491 If running under OSGi, use the Bundle's ClassLoader instead of the application one
            BrokerFactory factory;
            if (BundleUtils.runningUnderOSGi()) {
                factory = getBrokerFactory(cp, poolValue, BundleUtils.getBundleClassLoader());
            } else {
                factory = getBrokerFactory(cp, poolValue, pui.getClassLoader());
            }

            OpenJPAConfiguration conf = factory.getConfiguration();
            setPersistenceEnvironmentInfo(conf, pui);
            _log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
            // now we can log any transformer exceptions from above
            if (transformerException != null) {
                if (_log.isTraceEnabled()) {
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

        Map propsMap = new HashMap();
        propsMap.put("openjpa.DataCache", "true");
        propsMap.put("openjpa.RemoteCommitProvider", "sjvm");
        EntityManagerFactory emf = getEmf(propsMap);
        BrokerFactory factory = JPAFacadeHelper.toBrokerFactory(emf);

        Broker broker = factory.newBroker();
        broker.begin();
        broker.persist(new CacheObjectAChild1("foo", "foo", 0), null);
        broker.persist(new CacheObjectAChild1("bar", "bar", 1), null);
        broker.commit();
        broker.close();

        _broker = factory.newBroker();
    }
View Full Code Here

Examples of org.apache.openjpa.kernel.BrokerFactory

                // check if we've already warned for this query-factory combo
                StoreContext ctx = resolver.getQueryContext().getStoreContext();
                String query = currentQuery();
                if (ctx.getBroker() != null && query != null) {
                    String key = getClass().getName() + ":" + query;
                    BrokerFactory factory = ctx.getBroker().getBrokerFactory();
                    Object hasWarned = factory.getUserObject(key);
                    if (hasWarned != null)
                        break;
                    else
                        factory.putUserObject(key, Boolean.TRUE);
                }
                Log log = conf.getLog(OpenJPAConfiguration.LOG_QUERY);
                if (log.isWarnEnabled())
                    log.warn(_loc.get("query-extensions-warning", clause,
                        currentQuery()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.