Examples of BrokerFactory


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

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

        args = opts.setFromCmdLine(args);
        boolean devpath = opts.getBooleanProperty("scanDevPath", "ScanDevPath",
            true);

        ConfigurationProvider cp = new MapConfigurationProvider(opts);
        BrokerFactory factory = Bootstrap.newBrokerFactory(cp, null);
        try {
            MetaDataCacheMaintenance maint = new MetaDataCacheMaintenance(
                factory, devpath);

            if (args.length != 1) {
                usage();
                return;
            }

            if ("store".equals(args[0]))
                maint.store();
            else if ("dump".equals(args[0]))
                maint.dump();
            else
                usage();
        } finally {
            factory.close();
        }
    }
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();
            conf.setUserClassLoader(BundleUtils.getBundleClassLoader());
            _log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);           
            pd.checkPuNameCollisions(_log,name);
           
            // add enhancer
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

        List<String> slices = conf.getAvailableSliceNames();
        assertTrue(slices.size() > 1);
        assertTrue(slices.contains("One"));
        assertTrue(slices.contains("Two"));
        assertTrue(slices.contains("Three"));
        BrokerFactory bf = ((EntityManagerFactoryImpl) emf).getBrokerFactory();
        Broker broker = bf.newBroker();
        assertEquals(DistributedJDBCBrokerFactory.class, bf.getClass());
        assertEquals(DistributedBrokerImpl.class, broker.getClass());
        assertNotNull(conf.getDistributionPolicyInstance());

        emf.createEntityManager();
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

Examples of org.apache.openjpa.kernel.BrokerFactory

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

            BrokerFactory factory = getBrokerFactory(cp, poolValue, null);
            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

            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);
            return JPAFacadeHelper.toEntityManagerFactory(factory);
        } catch (Exception e) {
            throw PersistenceExceptions.toPersistenceException(e);
        }
    }
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.