Examples of OpenJPAConfiguration


Examples of org.apache.openjpa.conf.OpenJPAConfiguration

                } else {
                    if (log.isTraceEnabled()) {
                        log.trace(_loc.get("scanning-resource", rsrc));
                    }
                    mitr = new ResourceMetaDataIterator(rsrc, loader);
                    OpenJPAConfiguration conf = repos.getConfiguration();
                    Map peMap = null;
                    if (conf instanceof OpenJPAConfigurationImpl) {
                        peMap = ((OpenJPAConfigurationImpl) conf).getPersistenceEnvironment();
                    }
                    URL puUrl = peMap == null ? null : (URL) peMap.get(PERSISTENCE_UNIT_ROOT_URL);
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        String storeProps = Configurations.getProperties(storePlugin);
        AbstractStoreManager store = createStoreManager(storeCls,
            storeProps);

        // populate configuration
        OpenJPAConfiguration conf = store.newConfiguration();
        cp.setInto(conf);
        conf.supportedOptions().removeAll(store.getUnsupportedOptions());

        // create and pool a new factory
        return new AbstractStoreBrokerFactory(conf, storeCls, storeProps,
            store.getPlatform());
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        }
    }

    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.OpenJPAConfiguration

     */
    public static PersistenceCapable toPersistenceCapable(Object o, Object ctx){
        if (o instanceof PersistenceCapable)
            return (PersistenceCapable) o;

        OpenJPAConfiguration conf = null;
        if (ctx instanceof OpenJPAConfiguration)
            conf = (OpenJPAConfiguration) ctx;
        else if (ctx instanceof StateManager
            && ((StateManager) ctx).getGenericContext() instanceof StoreContext)
            conf = ((StoreContext) ((StateManager) ctx).getGenericContext())
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    public StoreCache getStoreCache() {
        _factory.lock();
        try {
            if (_cache == null) {
                OpenJPAConfiguration conf = _factory.getConfiguration();
                _cache = new StoreCacheImpl(this,
                    conf.getDataCacheManagerInstance().getSystemDataCache());
            }
            return _cache;
        } finally {
            _factory.unlock();
        }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        if (props == null)
            props = Collections.EMPTY_MAP;
        else if (!props.isEmpty())
            props = new HashMap(props);

        OpenJPAConfiguration conf = getConfiguration();
        String user = (String) Configurations.removeProperty
            ("ConnectionUserName", props);
        if (user == null)
            user = conf.getConnectionUserName();
        String pass = (String) Configurations.removeProperty
            ("ConnectionPassword", props);
        if (pass == null)
            pass = conf.getConnectionPassword();

        String str = (String) Configurations.removeProperty
            ("TransactionMode", props);
        boolean managed;
        if (str == null)
            managed = conf.isTransactionModeManaged();
        else {
            Value val = conf.getValue("TransactionMode");
            managed = Boolean.parseBoolean(val.unalias(str));
        }

        Object obj = Configurations.removeProperty("ConnectionRetainMode",
            props);
        int retainMode;
        if (obj instanceof Number)
            retainMode = ((Number) obj).intValue();
        else if (obj == null)
            retainMode = conf.getConnectionRetainModeConstant();
        else {
            Value val = conf.getValue("ConnectionRetainMode");
            try {
                retainMode = Integer.parseInt(val.unalias((String) obj));
            } catch (Exception e) {
                throw new ArgumentException(_loc.get("bad-em-prop",
                    "openjpa.ConnectionRetainMode", obj),
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    /**
     * Either throw a user exception or add the configuration to the given list,
     * based on <code>isLenient</code>.
     */
    private void handleBadConnection(boolean isLenient, Slice slice, Throwable ex) {
        OpenJPAConfiguration conf = slice.getConfiguration();
        String url = conf.getConnectionURL();
        Log log = conf.getConfigurationLog();
        if (isLenient) {
            if (ex != null) {
                log.warn(_loc.get("slice-connect-known-warn", slice, url, ex.getCause()));
            } else {
                log.warn(_loc.get("slice-connect-warn", slice, url));
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    private void assignVersionField(Object version) {

        if (version instanceof Timestamp) {
            if (_datePrecision == -1) {
                try {
                    OpenJPAConfiguration conf = _broker.getConfiguration();
                    Class confCls = Class.forName("org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl");
                    if (confCls.isAssignableFrom(conf.getClass())) {
                        Object o = conf.getClass().getMethod("getDBDictionaryInstance").invoke(conf, (Object[]) null);
                        _datePrecision = o.getClass().getField("datePrecision").getInt(o);
                    } else {
                        _datePrecision = 1000;
                    }
                } catch (Throwable e) {
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    public StoreCache getStoreCache() {
        _factory.lock();
        try {
            if (_cache == null) {
                OpenJPAConfiguration conf = _factory.getConfiguration();
                _cache = new StoreCacheImpl(this,
                    conf.getDataCacheManagerInstance().getSystemDataCache());
            }
            return _cache;
        } finally {
            _factory.unlock();
        }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        if (props == null)
            props = Collections.EMPTY_MAP;
        else if (!props.isEmpty())
            props = new HashMap(props);

        OpenJPAConfiguration conf = getConfiguration();
        Log log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
        String user = (String) Configurations.removeProperty("ConnectionUserName", props);
        if (user == null)
            user = conf.getConnectionUserName();
        String pass = (String) Configurations.removeProperty("ConnectionPassword", props);
        if (pass == null)
            pass = conf.getConnectionPassword();

        String str = (String) Configurations.removeProperty("TransactionMode", props);
        boolean managed;
        if (str == null)
            managed = conf.isTransactionModeManaged();
        else {
            Value val = conf.getValue("TransactionMode");
            managed = Boolean.parseBoolean(val.unalias(str));
        }

        Object obj = Configurations.removeProperty("ConnectionRetainMode", props);
        int retainMode;
        if (obj instanceof Number) {
            retainMode = ((Number) obj).intValue();
        } else if (obj == null) {
            retainMode = conf.getConnectionRetainModeConstant();
        } else {
            Value val = conf.getValue("ConnectionRetainMode");
            try {
                retainMode = Integer.parseInt(val.unalias((String) obj));
            } catch (Exception e) {
                throw new ArgumentException(_loc.get("bad-em-prop", "openjpa.ConnectionRetainMode", obj),
                    new Throwable[]{ e }, obj, 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.