~abone/+junk/schemaspy

« back to all changes in this revision

Viewing changes to src/net/sourceforge/schemaspy/MultipleSchemaAnalyzer.java

  • Committer: johncurrier
  • Date: 2010-05-10 20:11:55 UTC
  • Revision ID: svn-v4:e86a8a9b-1e1f-0410-8769-81452b7583c3:trunk:575
Implementation of feature request #2999566 - provide verbose details of program flow

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import java.util.Arrays;
13
13
import java.util.Iterator;
14
14
import java.util.List;
 
15
import java.util.logging.Level;
 
16
import java.util.logging.Logger;
15
17
import java.util.regex.Pattern;
16
18
import net.sourceforge.schemaspy.model.ProcessExecutionException;
17
19
import net.sourceforge.schemaspy.util.LineWriter;
22
24
 */
23
25
public final class MultipleSchemaAnalyzer {
24
26
    private static MultipleSchemaAnalyzer instance = new MultipleSchemaAnalyzer();
 
27
    private final Logger logger = Logger.getLogger(getClass().getName());
 
28
    private final boolean fineEnabled = logger.isLoggable(Level.FINE);
25
29
 
26
30
    private MultipleSchemaAnalyzer() {
27
31
    }
117
121
 
118
122
    private List<String> getPopulatedSchemas(DatabaseMetaData meta, String schemaSpec, String user) throws SQLException {
119
123
        List<String> populatedSchemas;
120
 
        boolean verbose = Config.getInstance().isVerboseExclusionsEnabled();
121
124
 
122
125
        if (meta.supportsSchemasInTableDefinitions()) {
123
126
            Pattern schemaRegex = Pattern.compile(schemaSpec);
127
130
            while (iter.hasNext()) {
128
131
                String schema = iter.next();
129
132
                if (!schemaRegex.matcher(schema).matches()) {
130
 
                    if (verbose) {
131
 
                        System.out.println("Excluding schema " + schema +
132
 
                                ": doesn't match + \"" + schemaRegex + '"');
 
133
                    if (fineEnabled) {
 
134
                        logger.fine("Excluding schema " + schema +
 
135
                                    ": doesn't match + \"" + schemaRegex + '"');
133
136
                    }
134
137
                    iter.remove(); // remove those that we're not supposed to analyze
135
138
                } else {
136
 
                    if (verbose) {
137
 
                        System.out.println("Including schema " + schema +
138
 
                                ": matches + \"" + schemaRegex + '"');
 
139
                    if (fineEnabled) {
 
140
                        logger.fine("Including schema " + schema +
 
141
                                    ": matches + \"" + schemaRegex + '"');
139
142
                    }
140
143
                }
141
144
            }