Package org.apache.openjpa.lib.log

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


                    // 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;
                    }
                } else {
                    if (!alreadyLoggedAlterSeqDisabled) {
                        Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
                        if (log.isWarnEnabled()) {
                            log.warn(_loc.get("alter-seq-disabled", _seqName));
                        }
                    }

                    alreadyLoggedAlterSeqDisabled = true;
                }
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

        return (T) _broker.newInstance(cls);
    }

    public void close() {
        assertNotCloseInvoked();
        Log log = _emf.getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);
        if (log.isTraceEnabled()) {
            log.trace(this + ".close() invoked.");
        }
        _broker.close();
        _plans.clear();
    }
View Full Code Here

     * then an warning message (not an exception as per JPA specification) is issued.
     */
    public void setProperty(String prop, Object value) {
        if (!setKernelProperty(this, prop, value)) {
            if (!setKernelProperty(this.getFetchPlan(), prop, value)) {
                Log log = getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);
                if (log.isWarnEnabled()) {
                    log.warn(_loc.get("ignored-em-prop", prop, value == null ? "" : value.getClass()+":" + value));
                 }
            }
        }
    }
View Full Code Here

        if ((_resMode & mode) == mode)
            return true;
        int cur = _resMode;
        _resMode |= mode;

        Log log = getRepository().getLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get("resolve-field", _owner + "@"
                + System.identityHashCode(_owner) + "." + _name));

        // we only perform actions for metadata mode
        if ((mode & MODE_META) == 0 || (cur & MODE_META) != 0)
            return false;
View Full Code Here

     */
    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);
                    if (log.isWarnEnabled())
                        log.warn(_loc.get("cant-embed", this));
                } else
                if (isEmbedded() && getDeclaredTypeCode() != JavaTypes.PC) {
                    setEmbedded(false);
                    if (log.isWarnEnabled())
                        log.warn(_loc.get("cant-embed-extern", this));
                }
                break;
            case JavaTypes.COLLECTION:
                if (!opts.contains(OpenJPAConfiguration.OPTION_TYPE_COLLECTION))
                    throw new UnsupportedException(
                        _loc.get("type-not-supported",
                            "Collection", this));
                if (_elem.isEmbeddedPC() && !opts.contains(
                    OpenJPAConfiguration.OPTION_EMBEDDED_COLLECTION_RELATION)){
                    _elem.setEmbedded(false);
                    if (log.isWarnEnabled())
                        log.warn(_loc.get("cant-embed-element", this));
                }
                break;
            case JavaTypes.ARRAY:
                if (!opts.contains(OpenJPAConfiguration.OPTION_TYPE_ARRAY))
                    throw new UnsupportedException(
                        _loc.get("type-not-supported",
                            "Array", this));
                if (_elem.isEmbeddedPC() && !opts.contains(
                    OpenJPAConfiguration.OPTION_EMBEDDED_COLLECTION_RELATION)) {
                    _elem.setEmbedded(false);
                    if (log.isWarnEnabled())
                        log.warn(_loc.get("cant-embed-element", this));
                }
                break;
            case JavaTypes.MAP:
                if (!opts.contains(OpenJPAConfiguration.OPTION_TYPE_MAP))
                    throw new UnsupportedException(
                        _loc.get("type-not-supported",
                            "Map", this));
                if (_elem.isEmbeddedPC() && !opts.contains(
                  OpenJPAConfiguration.OPTION_EMBEDDED_MAP_RELATION)) {
                    _elem.setEmbedded(false);
                    if (log.isWarnEnabled())
                        log.warn(_loc.get("cant-embed-element", this));
                }
                if (_key.isEmbeddedPC() && !opts.contains(
                  OpenJPAConfiguration.OPTION_EMBEDDED_MAP_RELATION)) {
                    _key.setEmbedded(false);
                    if (log.isWarnEnabled())
                        log.warn(_loc.get("cant-embed-key", this));
                }
                break;
        }
    }
View Full Code Here

                    (_conf.getMetaDataRepositoryInstance());
            }

            _conf.close();
            _closed = true;
            Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
            if (log.isTraceEnabled())
                _closedException = new IllegalStateException();
        } finally {
            unlock();
        }
    }
View Full Code Here

            // check again
            if (_readOnly)
                return;
            _readOnly = true;

            Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
            if (log.isInfoEnabled()) {
                log.info(getFactoryInitializationBanner());
            }
            if (log.isTraceEnabled()) {
                Map<String,Object> props = _conf.toProperties(true);
                String lineSep = J2DoPrivHelper.getLineSeparator();
                StringBuilder buf = new StringBuilder();
                Map.Entry<?,?> entry;
                for (Iterator<Map.Entry<String,Object>> itr = props.entrySet().iterator(); itr.hasNext();) {
                    entry = itr.next();
                    Object value = entry.getValue();
                    buf.append(entry.getKey()).append(": ")
                       .append(value != null && value.getClass().isArray() ? Arrays.toString((Object[])value) : value);
                    if (itr.hasNext())
                        buf.append(lineSep);
                }
                log.trace(_loc.get("factory-properties", buf.toString()));
            }

            // setup transient state
            setup();
View Full Code Here

    /**
     * Resolve metadata.
     */
    protected void resolveMeta(boolean runtime) {
        boolean embed = _owner != null && _owner.getDeclaredType() == _type;
        Log log = _repos.getLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get((embed) ? "resolve-embed-meta" : "resolve-meta",
                this + "@" + System.identityHashCode(this)));

        if (runtime && !_type.isInterface() &&
            !ImplHelper.isManagedType(getRepository().getConfiguration(),_type))
            throw new MetaDataException(_loc.get("not-enhanced", _type));
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.