Examples of OpenJPAConfiguration


Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    /**
     * Validate that this field is supported by the runtime.
     */
    private void validateSupportedType() {
        // log warnings about things we don't handle
        OpenJPAConfiguration conf = getRepository().getConfiguration();
        Collection<String> opts = conf.supportedOptions();
        Log log = conf.getLog(OpenJPAConfiguration.LOG_METADATA);
        switch (getTypeCode()) {
            case JavaTypes.PC:
                if (isEmbedded() && !opts.contains(
                  OpenJPAConfiguration.OPTION_EMBEDDED_RELATION)) {
                    setEmbedded(false);
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    /**
     * Assert that the given strategy is supported by the current runtime.
     */
    public static void assertSupported(int strategy, MetaDataContext context,
        String attributeName) {
        OpenJPAConfiguration conf = context.getRepository().getConfiguration();
        boolean supported = true;
        switch (strategy) {
            case AUTOASSIGN:
                supported = conf.supportedOptions().contains
                    (OpenJPAConfiguration.OPTION_VALUE_AUTOASSIGN);
                break;
            case INCREMENT:
                supported = conf.supportedOptions().contains
                    (OpenJPAConfiguration.OPTION_VALUE_INCREMENT);
                break;
            case NATIVE:
                supported = context instanceof ClassMetaData;
                break;
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

     */
    public static boolean run(final String[] args, Options opts) {
        return Configurations.runAgainstAllAnchors(opts,
            new Configurations.Runnable() {
            public boolean run(Options opts) throws IOException {
                OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
                try {
                    return PCEnhancer.run(conf, args, opts);
                } finally {
                    conf.close();
                }
            }
        });
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

            );
    }

    public void testBasic() throws Exception {
        OpenJPAEntityManagerSPI em = emf.createEntityManager();
        OpenJPAConfiguration conf = ((OpenJPAEntityManagerSPI) em).getConfiguration();
        ClearableScheduler scheduler = new ClearableScheduler(conf);
        // Make the scheduler run every 1 minute
        scheduler.setInterval(1);
        DummyCache cache1 = new DummyCache();
        DummyCache cache2 = new DummyCache();
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

            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);
           
            // Create appropriate LifecycleEventManager
            loadValidator(factory);
           
            if (conf.getConnectionRetainModeConstant() == ConnectionRetainModes.CONN_RETAIN_ALWAYS) {
                // warn about EMs holding on to connections.
                _log.warn(_loc.get("retain-always", conf.getId()));
            }
           
            OpenJPAEntityManagerFactory emf = JPAFacadeHelper.toEntityManagerFactory(factory);
            if (_log.isTraceEnabled()) {
                _log.trace(this + " creating " + emf + " for PU " + name + ".");
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

                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()) {
                    _log.warn(_loc.get("transformer-registration-error-ex", pui), transformerException);
                } else {
                    _log.warn(_loc.get("transformer-registration-error", pui));
                }
            }
           
            if (conf.getConnectionRetainModeConstant() == ConnectionRetainModes.CONN_RETAIN_ALWAYS) {
                // warn about container managed EMs holding on to connections.
                _log.warn(_loc.get("cm-retain-always",conf.getId()));
            }

            // Create appropriate LifecycleEventManager
            loadValidator(factory);
           
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

   
    /**
     * This private worker method will attempt load the PCEnhancerAgent.
     */
    private void loadAgent(BrokerFactory factory) {
        OpenJPAConfiguration conf = factory.getConfiguration();
        Log log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);

        if (conf.getDynamicEnhancementAgent() == true) {
            boolean res = PCEnhancerAgent.loadDynamicAgent(log);
            if (log.isInfoEnabled() && res == true ){
                log.info(_loc.get("dynamic-agent"));
            }
        }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

     * @param log
     * @param conf
     * @throws if validation setup failed and was required by the config
     */
    private void loadValidator(BrokerFactory factory) {
        OpenJPAConfiguration conf = factory.getConfiguration();
        Log log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);

        if ((ValidationUtils.setupValidation(conf) == true) &&
                log.isInfoEnabled()) {
            log.info(_loc.get("vlem-creation-info"));
        }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        assertNotEquals(conf, conf3);
    }

    public void testClassAliases()
        throws Exception {
        OpenJPAConfiguration conf = getConfiguration();
        if (!(conf instanceof OpenJPAConfigurationImpl))
            return;

        Value[] values = ((OpenJPAConfigurationImpl) conf).getValues();
        String[] aliases;
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

            fail(failures.toString());
    }

    public void testBeanAccessors()
        throws Exception {
        OpenJPAConfiguration conf = getConfiguration();
        OpenJPAConfigurationImpl simp = (OpenJPAConfigurationImpl) conf.clone();

        Value[] values = simp.getValues();
        PropertyDescriptor[] pds = simp.getPropertyDescriptors();
        List failures = new ArrayList();
        for (int i = 0; i < values.length; i++) {
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.