Package org.apache.openjpa.lib.log

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


     * Start processing <code>sql-result-set-mapping</code> node.
     * Pushes the {@link QueryResultMapping} onto the stack as current element.
     */
    private boolean startSQLResultSetMapping(Attributes attrs) {
        String name = attrs.getValue("name");
        Log log = getLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get("parse-sqlrsmapping", name));

        MappingRepository repos = (MappingRepository) getRepository();
        QueryResultMapping result = repos.getCachedQueryResultMapping
            (null, name);
        if (result != null && log.isWarnEnabled())
            log.warn(_loc.get("override-sqlrsmapping", name,
                currentLocation()));

        result = repos.addQueryResultMapping(null, name);
        result.setListingIndex(_resultIdx++);
        addComments(result);
View Full Code Here


            if (isVersion())
                _strategy = NoneFieldStrategy.getInstance();
            else
                repos.getStrategyInstaller().installStrategy(this);
        }
        Log log = getRepository().getLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get("field-strategy", getName(),
                _strategy.getAlias()));

        // mark mapped columns
        if (_orderCol.getColumn() != null) {
            if (getOrderColumnIO().isInsertable(0, false))
View Full Code Here

    void assertNoDuplicate(List<Field> fields, List<Method> getters) {
     
    }
   
    void error(ClassMetaData meta, Localizer.Message message) {
      Log log = meta.getRepository().getConfiguration()
        .getLog(OpenJPAConfiguration.LOG_RUNTIME);
      log.error(message.toString());
      throw new UserException(message.toString());
    }
View Full Code Here

      log.error(message.toString());
      throw new UserException(message.toString());
    }
   
    void warn(ClassMetaData meta, Localizer.Message message) {
      Log log = meta.getRepository().getConfiguration()
    .getLog(OpenJPAConfiguration.LOG_RUNTIME);
      log.warn(message.toString());
    }
View Full Code Here

    .getLog(OpenJPAConfiguration.LOG_RUNTIME);
      log.warn(message.toString());
    }

    void trace(ClassMetaData meta, Localizer.Message message) {
        Log log = meta.getRepository().getConfiguration()
        .getLog(OpenJPAConfiguration.LOG_RUNTIME);
        log.trace(message.toString());
    }
View Full Code Here

          return false;
        }
    }
   
    private void logNoSetter(ClassMetaData meta, String name, Exception e) {
        Log log = meta.getRepository().getConfiguration()
            .getLog(OpenJPAConfiguration.LOG_METADATA);
        if (log.isWarnEnabled())
            log.warn(_loc.get("no-setter-for-getter", name,
                meta.getDescribedType().getName()));
        else if (log.isTraceEnabled())
            // log the exception, if any, if we're in trace-level debugging
            log.warn(_loc.get("no-setter-for-getter", name,
                meta.getDescribedType().getName()), e);
    }
View Full Code Here

            }
           
            // If the compatibility option "filterPCRegistryClasses" is enabled, then verify that the type is
            // accessible to the envLoader/Thread Context ClassLoader
            if (_filterRegisteredClasses) {
                Log log = (_conf == null) ? null : _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
                ClassLoader loadCL = (envLoader != null) ?
                        envLoader :
                        AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction());
                       
                try {
                    Class<?> classFromAppClassLoader = Class.forName(reg[i].getName(), true, loadCL);
                   
                    if (!reg[i].equals(classFromAppClassLoader)) {
                        // This is a class that belongs to a ClassLoader not associated with the Application,
                        // so it should be processed.
                        if (log != null && log.isTraceEnabled()) {
                            log.trace(
                                "Metadata Repository will ignore Class " + reg[i].getName() +
                                ", since it originated from a ClassLoader not associated with the application.");
                        }
                        continue;
                    }
                } catch (ClassNotFoundException cnfe) {
                    // Catch exception and log its occurrence, and permit MDR processing to continue to preserve
                    // original behavior.
                    if (log != null && log.isTraceEnabled()) {
                        log.trace("The Class " + reg[i].getName() + " was identified as a persistent class " +
                            "by configuration, but the Class could not be found.");
                    }
                }
            }
View Full Code Here

     */
    private void checkEnhancementLevel(Class<?> cls) {
        if (_logEnhancementLevel == false) {
            return;
        }
        Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
        boolean res = PCEnhancer.checkEnhancementLevel(cls, _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME));
        if (log.isTraceEnabled() == false && res == true) {
            // Since trace isn't enabled flip the flag so we only log this once.
            _logEnhancementLevel = false;
            log.info(_loc.get("down-level-entity"));
        }
    }
View Full Code Here

            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);
            }
        }

        // javax.persistence.jtaDataSource and openjpa.ConnectionFactory name are equivalent.
        // prefer javax.persistence for now.
        String cfName = (String) Configurations.removeProperty("jtaDataSource", props)
        if(cfName == null) {
            cfName = (String) Configurations.removeProperty("ConnectionFactoryName", props);
        }
       
        String cf2Name = (String) Configurations.removeProperty("nonJtaDataSource", props);
       
        if(cf2Name == null) {
            cf2Name = (String) Configurations.removeProperty("ConnectionFactory2Name", props);
        }
       
        if (log != null && log.isTraceEnabled()) {
            if(StringUtils.isNotEmpty(cfName)) {
                log.trace("Found ConnectionFactoryName from props: " + cfName);
            }
            if(StringUtils.isNotEmpty(cf2Name)) {
                log.trace("Found ConnectionFactory2Name from props: " + cf2Name);
            }
        }
        validateCfNameProps(conf, cfName, cf2Name);

        Broker broker = _factory.newBroker(user, pass, managed, retainMode, false, cfName, cf2Name);
           
        // add autodetach for close and rollback conditions to the configuration
        broker.setAutoDetach(AutoDetach.DETACH_CLOSE, true);
        broker.setAutoDetach(AutoDetach.DETACH_ROLLBACK, true);
        broker.setDetachedNew(false);
       
        OpenJPAEntityManagerSPI em = newEntityManagerImpl(broker);

        // allow setting of other bean properties of EM
        Set<Map.Entry> entrySet = props.entrySet();
        for (Map.Entry entry : entrySet) {
            em.setProperty(entry.getKey().toString(), entry.getValue());
        }
        if (log != null && log.isTraceEnabled()) {
            log.trace(this + " created EntityManager " + em + ".");
        }
        return em;
    }
View Full Code Here

    public void removeTransactionListener(Object listener) {
        _factory.removeTransactionListener(listener);
    }

    public void close() {
        Log log = _factory.getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);
        if (log.isTraceEnabled()) {
            log.trace(this + ".close() invoked.");
        }
        _factory.close();
    }
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.