Package org.apache.openjpa.lib.log

Examples of org.apache.openjpa.lib.log.Log


                        props);

                // if the url and driver name aren't enough, connect to
                // the DB and use the connection metadata
                if (dbdictionary == null) {
                    Log log = getLog(LOG_JDBC);
                    if (log.isTraceEnabled()) {
                        Localizer loc = Localizer.forPackage
                            (JDBCConfigurationImpl.class);
                        log.trace(loc.get("connecting-for-dictionary"));
                    }

                    // use the base connection factory rather than the
                    // configured data source b/c the data source relies
                    // on passing the connection through the dictionary,
View Full Code Here


            DataSource ds = null;
            if (obj != null) {
                if (obj instanceof DataSource)
                    ds = (DataSource) obj;
                else {
                    Log log = getLog(LOG_JDBC);
                    if (log.isTraceEnabled()) {
                        Localizer loc = Localizer.forPackage(JDBCConfigurationImpl.class);
                        log.trace(loc.get("unknown-datasource", getConnectionFactory2Name(),
                            obj.getClass().getName()));
                    }
                }
            }
               
View Full Code Here

    /**
     * Create the connection factory if necessary.
     */
    public DecoratingDataSource createConnectionFactory() {
        DataSource ds = (DataSource) connectionFactory.get();
        Log log = getLog(LOG_JDBC);
        if (ds != null) {
            if (log.isTraceEnabled())
                log.trace("createConnectionFactory: DataSource:" + ds);

            return setupConnectionFactory(ds, false);
        }
               
        if (log.isTraceEnabled())
            log.trace("createConnectionFactory: connectionFactory not created yet, attempt JNDI lookup...");
        
        ds = (DataSource) super.getConnectionFactory(); // JNDI lookup
        if (ds == null) {
            if (log.isTraceEnabled())
                log.trace("createConnectionFactory: JNDI lookup failed, attempt DataSource properties...");
            ds = DataSourceFactory.newDataSource(this, false);
        }

        if (log.isTraceEnabled())
            log.trace("createConnectionFactory: DataSource="+ds);

        return setupConnectionFactory(ds, false);
    }
View Full Code Here

        return setupConnectionFactory(ds, false);
    }

    public DataSource getDataSource(StoreContext ctx) {      
        Log log = getLog(LOG_RUNTIME);
        DataSource ds = null;
       
        if(ctx != null && StringUtils.isNotEmpty(ctx.getConnectionFactoryName())) {
            ds =  getDataSource(ctx, (DataSource) ctx.getConnectionFactory());
            // fail fast if a cfName has been provided, but was not available in JNDI
            if (ds == null) {
                throw new UserException(_loc.get("invalid-datasource", ctx.getConnectionFactoryName())).setFatal(true);
            }
            if(! (ds instanceof DecoratingDataSource)) {
                ds = DataSourceFactory.decorateDataSource(ds, this, false);
            }
            if (log.isTraceEnabled()) {
                log.trace("Found datasource1: " + ds + " from StoreContext using jndiName: "
                    + ctx.getConnectionFactory2Name());
            }
            return ds;
        }
        else {
            ds = getDataSource(ctx, (DataSource) getConnectionFactory());
            if (log.isTraceEnabled()) {
                log.trace("Found datasource1: " + ds + " from configuration. StoreContext: " + ctx );
            }
            return ds;
        }
    }
View Full Code Here

            return ds;
        }
    }

    public DataSource getDataSource2(StoreContext ctx) {
        Log log = getLog(LOG_RUNTIME);
        DataSource ds = null;

        // Try to obtain from the StoreContext first.
        if (ctx != null && StringUtils.isNotEmpty(ctx.getConnectionFactory2Name())) {
            ds = (DataSource) ctx.getConnectionFactory2();
            if (ds == null) {
                // fail fast. If the non-jta-data-source is configured on the context we want an immediate error.
                throw new UserException(_loc.get("invalid-datasource", ctx.getConnectionFactory2Name())).setFatal(true);
            }
            if(! (ds instanceof DecoratingDataSource)) {
                ds = DataSourceFactory.decorateDataSource(ds, this, false);
            }
            if (log.isTraceEnabled()) {
                log.trace("Found datasource2: " + ds + " from StoreContext using jndiName: "
                    + ctx.getConnectionFactory2Name());
            }
            return ds;
        }

        // If not set on context or value from context is not available try cf2 from config
        else{
            ds = (DataSource) getConnectionFactory2();
            if (log.isTraceEnabled()) {
                log.trace("Found datasource 2: "+ ds + " from config. StoreContext: " + ctx);
            }
        }
       
        // fallback to cf1 / datasource1
        if (ds == null) {
            if(log.isTraceEnabled()) {
                log.trace("Trying datasource1");
            }
            return getDataSource(ctx);
        }

        // prefer the global connection 2 auth info if given
View Full Code Here

                DBDictionary dict = _conf.getDBDictionaryInstance();
                // If this fails, we will warn the user at most one time and set _allocated and _increment to 1 so
                // as to not potentially insert records ahead of what the database thinks is the next sequence value.
                if (updateSql(conn, dict.getAlterSequenceSQL(_seq)) == -1) {
                    if (!alreadyLoggedAlterSeqFailure) {
                        Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
                        if (log.isWarnEnabled()) {
                            log.warn(_loc.get("fallback-no-seq-cache", _seqName));
                        }
                    }
                    alreadyLoggedAlterSeqFailure = true;
                    _allocate = 1;
                }
View Full Code Here

    /**
     * Creates the sequence in the DB.
     */
    public void refreshSequence()
        throws SQLException {
        Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
        if (log.isInfoEnabled())
            log.info(_loc.get("make-native-seq"));

        // create the sequence
        SchemaTool tool = new SchemaTool(_conf);
        tool.setIgnoreErrors(true);
        tool.createSequence(_seq);
View Full Code Here

    /**
     * Drops the sequence in the DB.
     */
    public void dropSequence()
        throws SQLException {
        Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
        if (log.isInfoEnabled())
            log.info(_loc.get("drop-native-seq"));

        // drop the table
        SchemaTool tool = new SchemaTool(_conf);
        tool.setIgnoreErrors(true);
        tool.dropSequence(_seq);
View Full Code Here

                    throw new MetaDataException(_loc.get
                        ("mapped-inverse-unjoined", field.getName(),
                            field.getDefiningMapping(), mapped));

                // warn the user about making the collection side the owner
                Log log = field.getRepository().getLog();
                if (log.isInfoEnabled())
                    log.info(_loc.get("coll-owner", field, mapped));
                field.setForeignKey(mapped.getElementMapping().
                    getForeignKey());
            } else
                throw new MetaDataException(_loc.get("not-inv-relation",
                    field, mapped));
View Full Code Here

                        ((JDBCStoreManager)store).addToSqlCache(
                            relationFieldUnionCache, selKey, obj1);
                    }
                }
            }
            Log log = store.getConfiguration().
                getLog(JDBCConfiguration.LOG_JDBC);
            if (log.isTraceEnabled()){
                if (found)
                    log.trace(_loc.get("cache-hit", field, this.getClass()));                       
                else
                    log.trace(_loc.get("cache-missed", field, this.getClass()));
            }

            parmList = new ArrayList();
            ClassMapping mapping = field.getDefiningMapping();
            Object oid = sm.getObjectId();
View Full Code Here

TOP

Related Classes of org.apache.openjpa.lib.log.Log

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.