Package org.apache.openjpa.lib.conf

Examples of org.apache.openjpa.lib.conf.ConfigurationProvider


    public void execute() throws BuildException {
        // if the user didn't supply a conf file, load the default
        if (_conf == null)
            _conf = newConfiguration();
        if (_conf.getPropertiesResource() == null) {
            ConfigurationProvider cp = ProductDerivations.loadDefaults
                ((ClassLoader) AccessController.doPrivileged(
                    J2DoPrivHelper.getClassLoaderAction(_conf.getClass())));
            if (cp != null)
                cp.setInto(_conf);
        }

        String[] files = getFiles();
        try {
            executeOn(files);
View Full Code Here


     * your OpenJPA defaults, using <code>map</code> as overrides. This method
     * will return the same logical factory for invocations with the same
     * overrides.
     */
    public static OpenJPAEntityManagerFactory getEntityManagerFactory(Map map) {
        ConfigurationProvider cp = new PersistenceProductDerivation.
            ConfigurationProviderImpl(map);
        try {
            return JPAFacadeHelper.toEntityManagerFactory(
                Bootstrap.getBrokerFactory(cp, null));
        } catch (Exception e) {
View Full Code Here

        if (str != null && str.length() > 0) {
            // cache system properties to reduce load on file system
            Properties loaded = (Properties) _sysprops.get(str);
            if (loaded == null) {
                loaded = new Properties();
                ConfigurationProvider cp = (ConfigurationProvider) Configurations.getProperty(str, null);
               
                if (cp != null)
                    loaded.putAll(cp.getProperties());
                _sysprops.put(str, loaded);
            }
            p.putAll(loaded);
        }
       
View Full Code Here

     */
    public OpenJPAEntityManagerFactory createEntityManagerFactory(String name, String resource, Map m) {
        PersistenceProductDerivation pd = new PersistenceProductDerivation();
        try {
            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);
View Full Code Here

    public OpenJPAEntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo pui, Map m) {
        PersistenceProductDerivation pd = new PersistenceProductDerivation();
        try {
            Object poolValue = Configurations.removeProperty(EMF_POOL, m);
            ConfigurationProvider cp = pd.load(pui, m);
            if (cp == null)
                return null;

            // add enhancer
            Exception transformerException = null;
            String ctOpts = (String) Configurations.getProperty(CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
            try {
                pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
                    pui.getNewTempClassLoader(), newConfigurationImpl()));
            } catch (Exception e) {
                // fail gracefully
                transformerException = e;
            }

            // if the BrokerImpl hasn't been specified, switch to the
            // non-finalizing one, since anything claiming to be a container
            // should be doing proper resource management.
            if (!Configurations.containsProperty(BrokerValue.KEY, 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);
View Full Code Here

    PersistenceProductDerivation ppd = new PersistenceProductDerivation();
    OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
    String encryptedPassword = "encrypted_password";
    ClassLoader loader = null;

    ConfigurationProvider provider = ppd.load(
        PersistenceProductDerivation.RSRC_DEFAULT,
        "encryption_plugin_pu", loader);
    provider.setInto(conf);
    EncryptionProvider ep = conf.getEncryptionProvider();
    assertNotNull(ep);
    // Cast to test impl
    TestEncryptionProvider tep = (TestEncryptionProvider) ep;
View Full Code Here

    public void testEncryptionPluginConfigurationDefaultValue() throws Exception {
    PersistenceProductDerivation ppd = new PersistenceProductDerivation();
    OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
    ClassLoader loader = null;

    ConfigurationProvider provider = ppd.load(
        PersistenceProductDerivation.RSRC_DEFAULT,
        "encryption_plugin_default_pu", loader);
    provider.setInto(conf);

    assertNull(conf.getEncryptionProvider());
  }
View Full Code Here

    public void execute() throws BuildException {
        // if the user didn't supply a conf file, load the default
        if (_conf == null)
            _conf = newConfiguration();
        if (_conf.getPropertiesResource() == null) {
            ConfigurationProvider cp = ProductDerivations.loadDefaults
                (AccessController.doPrivileged(
                    J2DoPrivHelper.getClassLoaderAction(_conf.getClass())));
            if (cp != null)
                cp.setInto(_conf);
        }

        String[] files = getFiles();
        try {
            executeOn(files);
View Full Code Here

     * your OpenJPA defaults, using <code>map</code> as overrides. This method
     * will return the same logical factory for invocations with the same
     * overrides.
     */
    public static OpenJPAEntityManagerFactory getEntityManagerFactory(Map map) {
        ConfigurationProvider cp = new PersistenceProductDerivation.
            ConfigurationProviderImpl(map);
        try {
            return JPAFacadeHelper.toEntityManagerFactory(
                Bootstrap.getBrokerFactory(cp, null));
        } catch (Exception e) {
View Full Code Here

        Options opts = new Options();
        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);
View Full Code Here

TOP

Related Classes of org.apache.openjpa.lib.conf.ConfigurationProvider

Copyright © 2018 www.massapicom. 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.