Examples of OpenJPAConfigurationImpl


Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

        }
    }

    private static void registerClassLoadEnhancer(Instrumentation inst,
        Options opts) {
        OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
        Configurations.populateConfiguration(conf, opts);
        // don't allow connections
        conf.setConnectionUserName(null);
        conf.setConnectionPassword(null);
        conf.setConnectionURL(null);
        conf.setConnectionDriverName(null);
        conf.setConnectionFactoryName(null);
        // set single class resolver
        final ClassLoader tmpLoader = (ClassLoader) AccessController
            .doPrivileged(J2DoPrivHelper
                .newTemporaryClassLoaderAction((ClassLoader) AccessController
                    .doPrivileged(J2DoPrivHelper.getContextClassLoaderAction())
                    ));
        conf.setClassResolver(new ClassResolver() {
            public ClassLoader getClassLoader(Class context, ClassLoader env) {
                return tmpLoader;
            }
        });
        conf.setReadOnly(true);
        conf.instantiateAll(); // avoid threading issues

        PCClassFileTransformer transformer = new PCClassFileTransformer
            (conf.newMetaDataRepositoryInstance(), opts, tmpLoader);
        inst.addTransformer(transformer);
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

     */
    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.OpenJPAConfigurationImpl

    public TestPersistenceManagerFactoryImpl(String test) {
        super(test);
    }

    public void setUp() {
        _conf = new OpenJPAConfigurationImpl();
        _conf.setConnection2UserName("user");
        _conf.setConnection2Password("pass");
        _conf.setConnection2URL("url");
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

            return factory;
        }

        // standard brokerfactory getter implemented by subclasses
        public static BrokerFactoryTest newInstance(ConfigurationProvider cp) {
            OpenJPAConfigurationImpl conf = new OpenJPAConfigurationImpl();
            cp.setInto(conf);
            return new BrokerFactoryTest(conf);
        }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

    private void enhance() throws Exception {
        Properties props = getProperties(new String[]{
            "openjpa.DetachState", "DetachedStateField=true",
        });
        OpenJPAConfiguration conf = new OpenJPAConfigurationImpl(true, false);
        conf.fromProperties(props);

        Options opts = new Options();
        opts.put("jdo", "true");
        PCEnhancer.run(conf, new String[]{
            "org.apache.openjpa.persistence.kernel.noenhance.DetachSMPC" }, opts);
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

     * enhancement in ClassTransformerImpl. If OpenJPAConfigurationImpl
     * instance is used, configuration options declared in configuration
     * sub-class will not be recognized and a warning is posted in the log.
     */
    protected OpenJPAConfiguration newConfigurationImpl() {
        return new OpenJPAConfigurationImpl();
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

     */
    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.OpenJPAConfigurationImpl

        private final ClassFileTransformer _trans;

        private ClassTransformerImpl(ConfigurationProvider cp, String props,
            final ClassLoader tmpLoader) {
            // create an independent conf for enhancement
            OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
            cp.setInto(conf);
            // don't allow connections
            conf.setConnectionUserName(null);
            conf.setConnectionPassword(null);
            conf.setConnectionURL(null);
            conf.setConnectionDriverName(null);
            conf.setConnectionFactoryName(null);
            // use the tmp loader for everything
            conf.setClassResolver(new ClassResolver() {
                public ClassLoader getClassLoader(Class context,
                    ClassLoader env) {
                    return tmpLoader;
                }
            });
            conf.setReadOnly(true);

            MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
            repos.setResolve(MetaDataModes.MODE_MAPPING, false);
            _trans = new PCClassFileTransformer(repos,
                Configurations.parseProperties(props), tmpLoader);
        }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

    @Override
    public boolean beforeConfigurationLoad(Configuration c) {
        if (!(c instanceof OpenJPAConfigurationImpl))
            return false;
       
        OpenJPAConfigurationImpl conf = (OpenJPAConfigurationImpl) c;
        conf.metaFactoryPlugin.setAlias(ALIAS_EJB,
            PersistenceMetaDataFactory.class.getName());
        conf.metaFactoryPlugin.setAlias(SPEC_JPA,
            PersistenceMetaDataFactory.class.getName());
       
        conf.addValue(new EntityManagerFactoryValue());
        return true;
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfigurationImpl

    public boolean afterSpecificationSet(Configuration c) {
      if (!(c instanceof OpenJPAConfigurationImpl)
         || !SPEC_JPA.equals(((OpenJPAConfiguration) c).getSpecification()))
          return false;
        OpenJPAConfigurationImpl conf = (OpenJPAConfigurationImpl) c;
        conf.metaFactoryPlugin.setDefault(SPEC_JPA);
        conf.metaFactoryPlugin.setString(SPEC_JPA);
        conf.lockManagerPlugin.setDefault("version");
        conf.lockManagerPlugin.setString("version");
        conf.nontransactionalWrite.setDefault("true");
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.