Package org.apache.openjpa.lib.log

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


   
    DataSource createDataSource(Slice slice) throws Exception {
        JDBCConfiguration conf = (JDBCConfiguration)slice.getConfiguration();
        DataSource ds = (DataSource)conf.getConnectionFactory();
        if (ds == null) {
            Log log = conf.getConfigurationLog();
            String url = getConnectionInfo(conf);
            if (log.isInfoEnabled())
                log.info(_loc.get("slice-connect", slice, url));
            ds = DataSourceFactory.newDataSource(conf, false);
            DecoratingDataSource dds = new DecoratingDataSource(ds);
            ds = DataSourceFactory.installDBDictionary(
                    conf.getDBDictionaryInstance(), dds, conf, false);
        }
View Full Code Here


     * 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));
            }
        } else if (ex != null) {
            throw new UserException(_loc.get("slice-connect-known-error", slice, url, ex), ex.getCause());
        } else {
            throw new UserException(_loc.get("slice-connect-error", slice, url));
View Full Code Here

        setDiagnosticContext(child);
        child.setMappingDefaults(this.getMappingDefaultsInstance());
        child.setDataCacheManager(this.getDataCacheManagerInstance());
        child.setMetaDataRepository(this.getMetaDataRepositoryInstance());
        Slice slice = new Slice(key, child);
        Log log = getConfigurationLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get("slice-configuration", key, child
                    .toProperties(false)));
        return slice;
    }
View Full Code Here

     * are then ordered alphabetically by their identifier.
     */
    private List<String> findSlices(Map p) {
        List<String> sliceNames = new ArrayList<String>();
       
        Log log = getConfigurationLog();
        String key = namesPlugin.getProperty();
        boolean explicit = p.containsKey(key);
        if (explicit) {
            String[] values = p.get(key).toString().split("\\,");
            for (String name:values)
                if (!sliceNames.contains(name.trim()))
                    sliceNames.add(name.trim());
        } else {
            if (log.isWarnEnabled())
                log.warn(_loc.get("no-slice-names", key));
            sliceNames = scanForSliceNames(p);
            Collections.sort(sliceNames);
        }
        if (log.isInfoEnabled()) {
            log.info(_loc.get("slice-available", sliceNames));
        }
        return sliceNames;
    }
View Full Code Here

                e = ((PrivilegedActionException) e).getException();
            throw new UserException(e).setFatal(true);
        }

        // warn if we could not locate the appropriate dictionary
        Log log = conf.getLog(JDBCConfiguration.LOG_JDBC);
        if (log.isWarnEnabled() && dict.getClass() == DBDictionary.class)
            log.warn(_loc.get("warn-generic"));

        if (log.isInfoEnabled()) {
            String infoString = "";
            if (conn != null) {
                try {
                    DatabaseMetaData meta = conn.getMetaData();
                    infoString = " (" + meta.getDatabaseProductName() + " "
                        + meta.getDatabaseProductVersion() + " ,"
                        + meta.getDriverName() + " "
                        + meta.getDriverVersion() + ")";
                } catch (SQLException se) {
                    if (log.isTraceEnabled())
                        log.trace(se.toString(), se);
                }
            }

            log.info(_loc.get("using-dict", dclass, infoString));
        }

        // set the dictionary's metadata
        Configurations.configureInstance(dict, conf, props, "DBDictionary");
        if (conn != null) {
View Full Code Here

        try {
            vp.parse(url);
            _ormVersion = vp.getVersion();
            _schemaLocation = vp.getSchemaLocation();
        } catch (Throwable t) {
                Log log = getLog();
                if (log.isInfoEnabled())
                    log.trace(_loc.get("version-check-error",
                        url.toString()));
        }
        super.parse(url);
    }
View Full Code Here

        try {
            vp.parse(file);
            _ormVersion = vp.getVersion();
            _schemaLocation = vp.getSchemaLocation();
        } catch (Throwable t) {
                Log log = getLog();
                if (log.isInfoEnabled())
                    log.trace(_loc.get("version-check-error",
                        file.toString()));
        }
        super.parse(file);
    }
View Full Code Here

    /**
     * Log warning about an unsupported tag.
     */
    private void warnUnsupportedTag(String name) {
        Log log = getLog();
        if (log.isInfoEnabled())
            log.trace(_loc.get("unsupported-tag", name));
    }
View Full Code Here

                }
            }
            return true;
        }

        Log log = getLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get("parse-class", _cls.getName()));

        MetaDataRepository repos = getRepository();
        ClassMetaData meta = repos.getCachedMetaData(_cls);
        if (meta != null
            && ((isMetaDataMode() && (meta.getSourceMode() & MODE_META) != 0)
            || (isMappingMode() && (meta.getSourceMode() & MODE_MAPPING) != 0)))
        {
            if(isDuplicateClass(meta)) {
                if (log.isWarnEnabled()) {
                    log.warn(_loc.get("dup-metadata", _cls, getSourceName()));
                }
                if(log.isTraceEnabled()) {
                    log.trace(String.format(
                        "MetaData originally obtained from source: %s under mode: %d with scope: %s, and type: %d",
                        meta.getSourceName(), meta.getSourceMode(), meta.getSourceScope(), meta.getSourceType()));
                }
            }
            _cls = null;
View Full Code Here

     * Run the tool and write to the optionally provided map
     */
    public static void run(JDBCConfiguration conf, String[] args, Flags flags, ClassLoader loader,
        Map<Class<?>, String> output) throws IOException, SQLException {
        // parse the schema to reverse-map
        Log log = conf.getLog(OpenJPAConfiguration.LOG_TOOL);
        SchemaGroup schema;
        if (args.length == 0) {
            log.info(_loc.get("revtool-running"));
            SchemaGenerator gen = new SchemaGenerator(conf);
            gen.generateSchemas();
            schema = gen.getSchemaGroup();
        } else {
            SchemaParser parser = new XMLSchemaParser(conf);
            File file;
            for (int i = 0; i < args.length; i++) {
                file = Files.getFile(args[i], loader);
                log.info(_loc.get("revtool-running-file", file));
                parser.parse(file);
            }
            schema = parser.getSchemaGroup();
        }

        // flags
        ReverseMappingTool tool = newInstance(conf);
        tool.setSchemaGroup(schema);
        tool.setPackageName(flags.packageName);
        tool.setDirectory(flags.directory);
        tool.setUseSchemaName(flags.useSchemaName);
        tool.setUseForeignKeyName(flags.useForeignKeyName);
        tool.setNullableAsObject(flags.nullableAsObject);
        tool.setBlobAsObject(flags.blobAsObject);
        tool.setUseGenericCollections(flags.useGenericCollections);
        tool.setTypeMap(flags.typeMap);
        tool.setPrimaryKeyOnJoin(flags.primaryKeyOnJoin);
        tool.setUseDataStoreIdentity(flags.useDataStoreIdentity);
        tool.setUseBuiltinIdentityClass(flags.useBuiltinIdentityClass);
        tool.setInnerIdentityClasses(flags.innerIdentityClasses);
        tool.setIdentityClassSuffix(flags.identityClassSuffix);
        tool.setInverseRelations(flags.inverseRelations);
        tool.setDetachable(flags.detachable);
        tool.setGenerateAnnotations(flags.generateAnnotations);
        tool.setAccessType(flags.accessType);
        tool.setCustomizer(flags.customizer);
        tool.setCodeFormat(flags.format);
        tool.setUseSchemaElement(flags.useSchemaElement);

        // run
        log.info(_loc.get("revtool-map"));
        tool.run();
        if (flags.generateAnnotations) {
            log.info(_loc.get("revtool-gen-annos"));
            tool.buildAnnotations();
        }
        log.info(_loc.get("revtool-write-code"));
        tool.recordCode(output);
       
        if (!LEVEL_NONE.equals(flags.metaDataLevel)) {
            log.info(_loc.get("revtool-write-metadata"));
            tool.recordMetaData(LEVEL_CLASS.equals(flags.metaDataLevel));
        }
    }
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.