Example usage for org.apache.commons.logging Log debug

List of usage examples for org.apache.commons.logging Log debug

Introduction

In this page you can find the example usage for org.apache.commons.logging Log debug.

Prototype

void debug(Object message);

Source Link

Document

Logs a message with debug log level.

Usage

From source file:org.acmsl.queryj.debugging.QueryJDebuggingChain.java

/**
 * Sends given command to a concrete chain.
 * @param chain the concrete chain.//  w w w .j  ava2s . c  om
 * @param command the command that represents which actions should be done.
 * @param service the {@link org.acmsl.queryj.debugging.TemplateDebuggingService service}.
 * @return <code>true</code> if the command is processed by the chain.
 * @throws QueryJBuildException if the process fails.
 */
protected boolean process(@NotNull final Chain<QueryJCommand, QueryJBuildException, CH> chain,
        @NotNull final QueryJCommand command, @NotNull final TemplateDebuggingService<C> service)
        throws QueryJBuildException {
    final boolean result = false;

    @Nullable
    final Log t_Log = command.getLog();

    final boolean t_bLoggingEnabled = (t_Log != null);

    @NotNull
    TemplateDebuggingCommand t_DebugCommand = TemplateDebuggingCommand.NEXT;

    try {
        @Nullable
        CH t_CurrentCommandHandler = null;

        do {
            if (t_DebugCommand.equals(TemplateDebuggingCommand.NEXT)) {
                t_CurrentCommandHandler = getNextChainLink(chain, t_CurrentCommandHandler);
            } else if (t_DebugCommand.equals(TemplateDebuggingCommand.PREVIOUS)) {
                t_CurrentCommandHandler = getPreviousChainLink(chain, t_CurrentCommandHandler);
            }

            if (t_bLoggingEnabled) {
                t_Log.debug("Next handler: " + t_CurrentCommandHandler);
            }

            if (t_CurrentCommandHandler != null) {
                t_DebugCommand = service.debug(t_CurrentCommandHandler, command);
            }

            if (t_bLoggingEnabled) {
                t_Log.debug(t_CurrentCommandHandler + "#handle(QueryJCommand) returned " + result);
            }
        } while (t_CurrentCommandHandler != null);
    } catch (@NotNull final QueryJBuildException buildException) {
        cleanUpOnError(buildException, command);

        if (t_bLoggingEnabled) {
            t_Log.error("QueryJ could not generate sources correctly.", buildException);
        }

        throw buildException;
    }

    return result;
}

From source file:org.acmsl.queryj.metadata.engines.oracle.OracleMetadataManager.java

/**
 * Processes the schema.//from ww  w .  j a v a2s. c  om
 * @param tableNames the table names.
 * @param connection the database connection.
 * @param caseSensitiveness whether the checks are case sensitive or not.
 * @param metadataExtractionListener the metadata extraction listener.
 * @param metaLanguageUtils the {@link MetaLanguageUtils} instance.
 * @param metadataTypeManager the {@link MetadataTypeManager} instance.
 * @return the list of all table names.
 * @throws SQLException if the extraction fails.
 * @throws QueryJException if any other error occurs.
 */
@NotNull
@SuppressWarnings("unused")
protected List<Table<String, Attribute<String>, List<Attribute<String>>>> extractTableMetadata(
        @Nullable final List<String> tableNames, @NotNull final Connection connection,
        final boolean caseSensitiveness, @NotNull final MetadataExtractionListener metadataExtractionListener,
        @NotNull final MetaLanguageUtils metaLanguageUtils,
        @NotNull final MetadataTypeManager metadataTypeManager) throws SQLException, QueryJException {
    @NotNull
    final List<Table<String, Attribute<String>, List<Attribute<String>>>> result;

    @Nullable
    final Log t_Log = UniqueLogFactory.getLog(OracleMetadataManager.class);

    @Nullable
    SQLException sqlExceptionToThrow = null;

    @Nullable
    ResultSet t_rsResults = null;

    @Nullable
    PreparedStatement t_PreparedStatement = null;

    @Nullable
    TableIncompleteValueObject t_Table;

    @NotNull
    final Map<String, TableIncompleteValueObject> t_mTableMap = new HashMap<>();

    @NotNull
    final Map<String, List<AttributeIncompleteValueObject>> t_mColumnMap = new HashMap<>();

    @NotNull
    final Map<String, List<AttributeIncompleteValueObject>> t_mPrimaryKeyMap = new HashMap<>();

    @NotNull
    final Map<String, List<ForeignKeyIncompleteValueObject>> t_mForeignKeyMap = new HashMap<>();

    @NotNull
    final Map<String, List<AttributeIncompleteValueObject>> t_mForeignKeyAttributeMap = new HashMap<>();

    try {
        @NotNull
        final String t_strQuery = "select c.table_name, " + "tc.comments table_comment, " + "c.column_name, "
                + "uc.comments column_comment, " + "c.data_type, " + "c.data_length, " + "c.data_precision, "
                + "c.data_scale, " + "c.nullable, " + "c.column_id, " + "cons.position pk_position, "
                + "fks.constraint_name fk_name, " + "fks.target_table, " + "fks.position fk_position "
                + "from user_tab_comments tc, user_col_comments uc, " + "user_tab_columns c " + LEFT_OUTER_JOIN
                + "select ucc.* " + "from user_cons_columns ucc, user_constraints uc "
                + "where uc.constraint_type = 'P' and uc.status = 'ENABLED' "
                + "and uc.constraint_name = ucc.constraint_name) cons "
                + "on c.table_name = cons.table_name and c.column_name = cons.column_name " + LEFT_OUTER_JOIN
                + "select rcon.constraint_name, " + "col.position, " + "rcol.table_name source_table, "
                + "con.table_name target_table, " + "rcol.column_name " + "from user_constraints con, "
                + "user_cons_columns col, " + "user_constraints rcon, " + "user_cons_columns rcol "
                + "where rcon.constraint_type = 'R' " + "and rcon.r_constraint_name = con.constraint_name "
                + "and col.table_name = con.table_name " + "and col.constraint_name = con.constraint_name "
                + "and rcol.table_name = rcon.table_name " + "and rcol.constraint_name = rcon.constraint_name "
                + "and rcol.position = col.position) fks "
                + "on c.table_name = fks.source_table and c.column_name = fks.column_name "
                + "where instr(tc.table_name, '$') = 0 " + "and tc.table_name = c.table_name "
                + "and tc.table_name = uc.table_name " + "and c.column_name = uc.column_name ";

        if ((t_Log != null) && (t_Log.isDebugEnabled())) {
            t_Log.debug("query:" + t_strQuery);
        }

        t_PreparedStatement = connection.prepareStatement(t_strQuery);
    } catch (@NotNull final SQLException invalidQuery) {
        sqlExceptionToThrow = invalidQuery;
    }

    if (t_PreparedStatement != null) {
        try {
            t_rsResults = t_PreparedStatement.executeQuery();
        } catch (@NotNull final SQLException queryFailed) {
            sqlExceptionToThrow = queryFailed;
        }
    }

    if (t_rsResults != null) {
        try {
            while (t_rsResults.next()) {
                processRow(t_rsResults, t_mTableMap, t_mColumnMap, t_mPrimaryKeyMap, t_mForeignKeyMap,
                        t_mForeignKeyAttributeMap, caseSensitiveness, metaLanguageUtils, metadataTypeManager);
            }
        } catch (@NotNull final SQLException errorIteratingResults) {
            sqlExceptionToThrow = errorIteratingResults;
        }
    }

    if (t_rsResults != null) {
        try {
            t_rsResults.close();
        } catch (@NotNull final SQLException sqlException) {
            if (t_Log != null) {
                t_Log.error("Cannot close the result set.", sqlException);
            }
        }
    }

    if (t_PreparedStatement != null) {
        try {
            t_PreparedStatement.close();
        } catch (@NotNull final SQLException sqlException) {
            if (t_Log != null) {
                t_Log.error("Cannot close the statement.", sqlException);
            }
        }
    }

    if (sqlExceptionToThrow != null) {
        throw sqlExceptionToThrow;
    }

    buildUpTables(t_mTableMap, t_mColumnMap, t_mPrimaryKeyMap, t_mForeignKeyMap, t_mForeignKeyAttributeMap,
            caseSensitiveness, metaLanguageUtils);

    result = cloneTables(t_mTableMap.values());

    return result;
}

From source file:org.acmsl.queryj.metadata.MetadataExtractionLogger.java

/**
 * Logs a debug message./* ww  w.j  ava2 s  .  c o  m*/
 * @param message the message to log as debug.
 */
protected void debug(@NotNull final String message) {
    @Nullable
    final Log t_Log = LOG;

    if (t_Log != null) {
        t_Log.debug(message);
    }
}

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataLoggingHandler.java

/**
 * Handles given information./*from ww w .j  a  v  a  2s.  c  o m*/
 * @param metaData the database metadata.
 * @return <code>true</code> if the chain should be stopped.
 * @throws QueryJBuildException if the metadata cannot be logged.
 */
protected boolean handle(@NotNull final DatabaseMetaData metaData) throws QueryJBuildException {
    final boolean result = false;

    @Nullable
    Log t_Log = null;

    try {
        t_Log = UniqueLogFactory.getLog(DatabaseMetaDataLoggingHandler.class);

        if (t_Log != null) {
            t_Log.debug("Numeric functions:" + metaData.getNumericFunctions());

            t_Log.debug("String functions:" + metaData.getStringFunctions());

            t_Log.debug("System functions:" + metaData.getSystemFunctions());

            t_Log.debug("Time functions:" + metaData.getTimeDateFunctions());

            t_Log.debug("insertsAreDetected(TYPE_FORWARD_ONLY):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("insertsAreDetected(TYPE_SCROLL_INSENSITIVE):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("insertsAreDetected(TYPE_SCROLL_SENS):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("isCatalogAtStart():" + metaData.isCatalogAtStart());

            t_Log.debug("isReadOnly():" + metaData.isReadOnly());

            /*
             * Fails for MySQL with a java.lang.AbstractMethodError 
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.locatorsUpdateCopy()
             t_Log.debug(
               "locatorsUpdateCopy():"
             + metaData.locatorsUpdateCopy());
             */

            t_Log.debug("nullPlusNonNullIsNull():" + metaData.nullPlusNonNullIsNull());

            t_Log.debug("nullsAreSortedAtEnd():" + metaData.nullsAreSortedAtEnd());

            t_Log.debug("nullsAreSortedAtStart():" + metaData.nullsAreSortedAtStart());

            t_Log.debug("nullsAreSortedHigh():" + metaData.nullsAreSortedHigh());

            t_Log.debug("nullsAreSortedLow():" + metaData.nullsAreSortedLow());

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("storesLowerCaseIdentifiers():" + metaData.storesLowerCaseIdentifiers());

            t_Log.debug("storesLowerCaseQuotedIdentifiers():" + metaData.storesLowerCaseQuotedIdentifiers());

            t_Log.debug("storesMixedCaseIdentifiers():" + metaData.storesMixedCaseIdentifiers());

            t_Log.debug("storesMixedCaseQuotedIdentifiers():" + metaData.storesMixedCaseQuotedIdentifiers());

            t_Log.debug("storesUpperCaseIdentifiers():" + metaData.storesUpperCaseIdentifiers());

            t_Log.debug("storesUpperCaseQuotedIdentifiers():" + metaData.storesUpperCaseQuotedIdentifiers());

            t_Log.debug("supportsAlterTableWithAddColumn():" + metaData.supportsAlterTableWithAddColumn());

            t_Log.debug("supportsAlterTableWithDropColumn():" + metaData.supportsAlterTableWithDropColumn());

            t_Log.debug("supportsANSI92EntryLevelSQL():" + metaData.supportsANSI92EntryLevelSQL());

            t_Log.debug("supportsANSI92FullSQL():" + metaData.supportsANSI92FullSQL());

            t_Log.debug("supportsANSI92IntermediateSQL():" + metaData.supportsANSI92IntermediateSQL());

            t_Log.debug("supportsBatchUpdates():" + metaData.supportsBatchUpdates());

            t_Log.debug(
                    "supportsCatalogsInDataManipulation():" + metaData.supportsCatalogsInDataManipulation());

            t_Log.debug(
                    "supportsCatalogsInIndexDefinitions():" + metaData.supportsCatalogsInIndexDefinitions());

            t_Log.debug("supportsCatalogsInPrivilegeDefinitions():"
                    + metaData.supportsCatalogsInPrivilegeDefinitions());

            t_Log.debug("supportsCatalogsInProcedureCalls():" + metaData.supportsCatalogsInProcedureCalls());

            t_Log.debug(
                    "supportsCatalogsInTableDefinitions():" + metaData.supportsCatalogsInTableDefinitions());

            t_Log.debug("supportsColumnAliasing():" + metaData.supportsColumnAliasing());

            t_Log.debug("supportsConvert():" + metaData.supportsConvert());

            t_Log.debug("supportsCoreSQLGrammar():" + metaData.supportsCoreSQLGrammar());

            t_Log.debug("supportsCorrelatedSubqueries():" + metaData.supportsCorrelatedSubqueries());

            t_Log.debug("supportsDataDefinitionAndDataManipulationTransactions():"
                    + metaData.supportsDataDefinitionAndDataManipulationTransactions());

            t_Log.debug("supportsDataManipulationTransactionsOnly():"
                    + metaData.supportsDataManipulationTransactionsOnly());

            t_Log.debug("supportsDifferentTableCorrelationNames():"
                    + metaData.supportsDifferentTableCorrelationNames());

            t_Log.debug("supportsExpressionsInOrderBy():" + metaData.supportsExpressionsInOrderBy());

            t_Log.debug("supportsExtendedSQLGrammar():" + metaData.supportsExtendedSQLGrammar());

            t_Log.debug("supportsFullOuterJoins():" + metaData.supportsFullOuterJoins());

            String t_strSupportsGetGeneratedKeys = Boolean.FALSE.toString();

            try {
                t_strSupportsGetGeneratedKeys = "" + metaData.supportsGetGeneratedKeys();
            } catch (@NotNull final SQLException sqlException) {
                t_strSupportsGetGeneratedKeys += sqlException.getMessage();
            }

            t_Log.debug("supportsGetGeneratedKeys():" + t_strSupportsGetGeneratedKeys);

            t_Log.debug("supportsGroupBy():" + metaData.supportsGroupBy());

            t_Log.debug("supportsGroupByBeyondSelect():" + metaData.supportsGroupByBeyondSelect());

            t_Log.debug("supportsGroupByUnrelated():" + metaData.supportsGroupByUnrelated());

            t_Log.debug("supportsIntegrityEnhancementFacility():"
                    + metaData.supportsIntegrityEnhancementFacility());

            t_Log.debug("supportsLikeEscapeClause():" + metaData.supportsLikeEscapeClause());

            t_Log.debug("supportsLimitedOuterJoins():" + metaData.supportsLimitedOuterJoins());

            t_Log.debug("supportsMinimumSQLGrammar():" + metaData.supportsMinimumSQLGrammar());

            t_Log.debug("supportsMixedCaseIdentifiers():" + metaData.supportsMixedCaseIdentifiers());

            t_Log.debug(
                    "supportsMixedCaseQuotedIdentifiers():" + metaData.supportsMixedCaseQuotedIdentifiers());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsMultipleOpenResults()
             t_Log.debug(
               "supportsMultipleOpenResults():"
             + metaData.supportsMultipleOpenResults());
             */

            t_Log.debug("supportsMultipleResultSets():" + metaData.supportsMultipleResultSets());

            t_Log.debug("supportsMultipleTransactions():" + metaData.supportsMultipleTransactions());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsNamedParameters()
             t_Log.debug(
               "supportsNamedParameters():"
             + metaData.supportsNamedParameters());
             */

            t_Log.debug("supportsNonNullableColumns():" + metaData.supportsNonNullableColumns());

            t_Log.debug("supportsOpenCursorsAcrossCommit():" + metaData.supportsOpenCursorsAcrossCommit());

            t_Log.debug("supportsOpenCursorsAcrossRollback():" + metaData.supportsOpenCursorsAcrossRollback());

            t_Log.debug(
                    "supportsOpenStatementsAcrossCommit():" + metaData.supportsOpenStatementsAcrossCommit());

            t_Log.debug("supportsOpenStatementsAcrossRollback():"
                    + metaData.supportsOpenStatementsAcrossRollback());

            t_Log.debug("supportsOrderByUnrelated():" + metaData.supportsOrderByUnrelated());

            t_Log.debug("supportsOuterJoins():" + metaData.supportsOuterJoins());

            t_Log.debug("supportsPositionedDelete():" + metaData.supportsPositionedDelete());

            t_Log.debug("supportsPositionedUpdate():" + metaData.supportsPositionedUpdate());

            t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_READ_ONLY):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_UPDATABLE):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY):"
                    + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE):"
                    + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_UPDATABLE));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE));

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsResultSetHoldability()
             t_Log.debug(
               "supportsResultSetHoldability("
             +     "HOLD_CURSORS_OVER_COMMIT):"
             + metaData.supportsResultSetHoldability(
             ResultSet.HOLD_CURSORS_OVER_COMMIT));
                    
             t_Log.debug(
               "supportsResultSetHoldability("
             +     "CLOSE_CURSORS_AT_COMMIT):"
             + metaData.supportsResultSetHoldability(
             ResultSet.CLOSE_CURSORS_AT_COMMIT));
             */

            t_Log.debug("supportsResultSetType(TYPE_FORWARD_ONLY):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("supportsResultSetType(TYPE_SCROLL_SENSITIVE):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE));

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsSavePoints()
             t_Log.debug(
               "supportsSavepoints():"
             + metaData.supportsSavepoints());
             */

            t_Log.debug("supportsSchemasInDataManipulation():" + metaData.supportsSchemasInDataManipulation());

            t_Log.debug("supportsSchemasInIndexDefinitions():" + metaData.supportsSchemasInIndexDefinitions());

            t_Log.debug("supportsSchemasInPrivilegeDefinitions():"
                    + metaData.supportsSchemasInPrivilegeDefinitions());

            t_Log.debug("supportsSchemasInProcedureCalls():" + metaData.supportsSchemasInProcedureCalls());

            t_Log.debug("supportsSchemasInTableDefinitions():" + metaData.supportsSchemasInTableDefinitions());

            t_Log.debug("supportsSelectForUpdate():" + metaData.supportsSelectForUpdate());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsStatementPooling()
             t_Log.debug(
               "supportsStatementPooling():"
             + metaData.supportsStatementPooling());
            */

            t_Log.debug("supportsStoredProcedures():" + metaData.supportsStoredProcedures());

            t_Log.debug("supportsSubqueriesInComparisons():" + metaData.supportsSubqueriesInComparisons());

            t_Log.debug("supportsSubqueriesInExists():" + metaData.supportsSubqueriesInExists());

            t_Log.debug("supportsSubqueriesInIns():" + metaData.supportsSubqueriesInIns());

            t_Log.debug("supportsSubqueriesInQuantifieds():" + metaData.supportsSubqueriesInQuantifieds());

            t_Log.debug("supportsTableCorrelationNames():" + metaData.supportsTableCorrelationNames());

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_NONE):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_COMMITTED):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_UNCOMMITTED):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_REPEATABLE_READ):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_SERIALIZABLE):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE));

            t_Log.debug("supportsTransactions():" + metaData.supportsTransactions());

            t_Log.debug("supportsUnion():" + metaData.supportsUnion());

            t_Log.debug("supportsUnionAll():" + metaData.supportsUnionAll());

            t_Log.debug("updatesAreDetected(TYPE_FORWARD_ONLY):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("updatesAreDetected(TYPE_SCROLL_INSENSITIVE):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("updatesAreDetected(" + "TYPE_SCROLL_SENS):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("usesLocalFilePerTable():" + metaData.usesLocalFilePerTable());

            t_Log.debug("usesLocalFiles():" + metaData.usesLocalFiles());
        }
    } catch (@NotNull final SQLException sqlException) {
        t_Log.error("Database metadata request failed.", sqlException);
    }

    return result;
}

From source file:org.acmsl.queryj.tools.handlers.JdbcConnectionClosingHandler.java

/**
 * Waits until all generation threads have finish.
 * @param tasks the tasks.//from   w  ww . j a va 2s . co  m
 * @param log the {@link Log} instance.
 */
protected void waitUntilGenerationThreadsFinish(
        @NotNull final List<Future<? extends QueryJTemplate<QueryJTemplateContext>>> tasks,
        @Nullable final Log log) {
    for (@Nullable
    final Future<? extends QueryJTemplate<QueryJTemplateContext>> t_Task : tasks) {
        if (t_Task != null) {
            while (!t_Task.isDone()) {
                try {
                    if (log != null) {
                        log.debug("Waiting for " + t_Task.get().getTemplateContext().getTemplateName()
                                + " to finish");
                    }
                } catch (@NotNull final InterruptedException interrupted) {
                    log.info(INTERRUPTED_WHILE_WAITING_FOR_THE_THREADS_TO_FINISH, interrupted);
                } catch (@NotNull final ExecutionException interrupted) {
                    log.info(interrupted.getMessage());

                    Throwable cause = interrupted.getCause();

                    while (cause != null) {
                        log.error(cause.getMessage(), cause);
                        cause = cause.getCause();
                    }
                }

                synchronized (LOCK) {
                    try {
                        LOCK.wait(1000);
                    } catch (@NotNull final InterruptedException interrupted) {
                        if (log != null) {
                            log.info(INTERRUPTED_WHILE_WAITING_FOR_THE_THREADS_TO_FINISH, interrupted);
                        }
                    }
                }
            }
        }
    }
}

From source file:org.alfresco.extension.bulkimport.util.LogUtils.java

public final static void debug(final Log log, final String message) {
    log.debug(PREFIX + message);
}

From source file:org.alfresco.repo.action.executer.TransformActionExecuter.java

@Override
public boolean onLogException(Log logger, Throwable t, String message) {
    if (t instanceof UnimportantTransformException) {
        logger.debug(message);
        return true;
    } else if (t instanceof UnsupportedTransformationException) {
        logger.error(message);/*from  w  w  w  .ja v a2  s .  c  o m*/
        return true;
    }
    return false;
}

From source file:org.alfresco.repo.forms.processor.FilteredFormProcessor.java

/**
 * Generates the form./*w  ww  .j  av  a2 s  .co  m*/
 * 
 * @param item The object to generate a form for
 * @param fields Restricted list of fields to include
 * @param forcedFields List of fields to forcibly include
 * @param form The form object being generated
 * @param context Map representing optional context that can be used during
 *            retrieval of the form
 */
protected void internalGenerate(ItemType item, List<String> fields, List<String> forcedFields, Form form,
        Map<String, Object> context) {
    Log log = getLogger();
    if (log.isDebugEnabled())
        log.debug("Generating form for: " + item);

    // generate the form type and URI for the item.
    Item formItem = form.getItem();
    formItem.setType(getItemType(item));
    formItem.setUrl(getItemURI(item));

    Object itemData = makeItemData(item);
    FormCreationData data = new FormCreationDataImpl(itemData, forcedFields, context);
    populateForm(form, fields, data);
    if (log.isDebugEnabled()) //
        log.debug("Generated form: " + form);
}

From source file:org.alfresco.repo.replication.ReplicationActionExecutor.java

@Override
public boolean onLogException(Log logger, Throwable t, String message) {
    if (t instanceof ActionCancelledException || t instanceof DisabledReplicationJobException) {
        logger.debug(message);
        return true;
    }//from   w w w  . j  a  v  a 2  s .c om
    return false;
}

From source file:org.alfresco.repo.web.util.HttpRangeProcessor.java

/**
 * Process multiple ranges./*from w w w  . ja v  a 2s  . com*/
 * 
 * @param res        HttpServletResponse
 * @param range      Range header value
 * @param ref        NodeRef to the content for streaming
 * @param property   Content Property for the content
 * @param mimetype   Mimetype of the content
 * @param userAgent  User Agent of the caller
 * 
 * @return true if processed range, false otherwise
 */
private boolean processMultiRange(Object res, String range, NodeRef ref, QName property, String mimetype,
        String userAgent) throws IOException {
    final Log logger = getLogger();

    // Handle either HttpServletResponse or WebScriptResponse
    HttpServletResponse httpServletResponse = null;
    WebScriptResponse webScriptResponse = null;
    if (res instanceof HttpServletResponse) {
        httpServletResponse = (HttpServletResponse) res;
    } else if (res instanceof WebScriptResponse) {
        webScriptResponse = (WebScriptResponse) res;
    }
    if (httpServletResponse == null && webScriptResponse == null) {
        // Unknown response object type
        return false;
    }

    // return the sets of bytes as requested in the content-range header
    // the response will be formatted as multipart/byteranges media type message

    /* Examples of byte-ranges-specifier values (assuming an entity-body of length 10000):
            
    - The first 500 bytes (byte offsets 0-499, inclusive):  bytes=0-499
    - The second 500 bytes (byte offsets 500-999, inclusive):
      bytes=500-999
    - The final 500 bytes (byte offsets 9500-9999, inclusive):
      bytes=-500
    - Or bytes=9500-
    - The first and last bytes only (bytes 0 and 9999):  bytes=0-0,-1
    - Several legal but not canonical specifications of byte offsets 500-999, inclusive:
       bytes=500-600,601-999
       bytes=500-700,601-999 */

    boolean processedRange = false;

    // get the content reader
    ContentReader reader = contentService.getReader(ref, property);

    final List<Range> ranges = new ArrayList<Range>(8);
    long entityLength = reader.getSize();
    for (StringTokenizer t = new StringTokenizer(range, ", "); t.hasMoreTokens(); /**/) {
        try {
            ranges.add(Range.constructRange(t.nextToken(), mimetype, entityLength));
        } catch (IllegalArgumentException err) {
            if (getLogger().isDebugEnabled())
                getLogger()
                        .debug("Failed to parse range header - returning 416 status code: " + err.getMessage());

            if (httpServletResponse != null) {
                httpServletResponse.setStatus(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
                httpServletResponse.setHeader(HEADER_CONTENT_RANGE, "\"*\"");
                httpServletResponse.getOutputStream().close();
            } else if (webScriptResponse != null) {
                webScriptResponse.setStatus(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
                webScriptResponse.setHeader(HEADER_CONTENT_RANGE, "\"*\"");
                webScriptResponse.getOutputStream().close();
            }
            return true;
        }
    }

    if (ranges.size() != 0) {
        // merge byte ranges if possible - IE handles this well, FireFox not so much
        if (userAgent == null || userAgent.indexOf("MSIE ") != -1) {
            Collections.sort(ranges);

            for (int i = 0; i < ranges.size() - 1; i++) {
                Range first = ranges.get(i);
                Range second = ranges.get(i + 1);
                if (first.end + 1 >= second.start) {
                    if (logger.isDebugEnabled())
                        logger.debug("Merging byte range: " + first + " with " + second);

                    if (first.end < second.end) {
                        // merge second range into first
                        first.end = second.end;
                    }
                    // else we simply discard the second range - it is contained within the first

                    // delete second range
                    ranges.remove(i + 1);
                    // reset loop index
                    i--;
                }
            }
        }

        // calculate response content length
        long length = MULTIPART_BYTERANGES_BOUNDRY_END.length() + 2;
        for (Range r : ranges) {
            length += r.getLength();
        }

        // output headers as we have at least one range to process
        OutputStream os = null;
        if (httpServletResponse != null) {
            httpServletResponse.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
            httpServletResponse.setHeader(HEADER_CONTENT_TYPE, MULTIPART_BYTERANGES_HEADER);
            httpServletResponse.setHeader(HEADER_CONTENT_LENGTH, Long.toString(length));
            os = httpServletResponse.getOutputStream();
        } else if (webScriptResponse != null) {
            webScriptResponse.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
            webScriptResponse.setHeader(HEADER_CONTENT_TYPE, MULTIPART_BYTERANGES_HEADER);
            webScriptResponse.setHeader(HEADER_CONTENT_LENGTH, Long.toString(length));
            os = webScriptResponse.getOutputStream();
        }

        InputStream is = null;
        try {
            for (Range r : ranges) {
                if (logger.isDebugEnabled())
                    logger.debug("Processing: " + r.getContentRange());

                try {
                    // output the header bytes for the range
                    if (os instanceof ServletOutputStream)
                        r.outputHeader((ServletOutputStream) os);

                    // output the binary data for the range
                    // need a new reader for each new InputStream
                    is = contentService.getReader(ref, property).getContentInputStream();
                    streamRangeBytes(r, is, os, 0L);
                    is.close();
                    is = null;

                    // section marker and flush stream
                    if (os instanceof ServletOutputStream)
                        ((ServletOutputStream) os).println();
                    os.flush();
                } catch (IOException err) {
                    if (getLogger().isDebugEnabled())
                        getLogger().debug(
                                "Unable to process multiple range due to IO Exception: " + err.getMessage());
                    throw err;
                }
            }
        } finally {
            if (is != null) {
                is.close();
            }
        }

        // end marker
        if (os instanceof ServletOutputStream)
            ((ServletOutputStream) os).println(MULTIPART_BYTERANGES_BOUNDRY_END);
        os.close();
        processedRange = true;
    }

    return processedRange;
}