Skip to content

Commit

Permalink
Resolved bug 3296973 - Tables not included with -i appears in relatio…
Browse files Browse the repository at this point in the history
…nship tab. Also reduced config params being passed everywhere.
  • Loading branch information
johncurrier committed May 5, 2011
1 parent 9b412f1 commit 660385e
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 177 deletions.
10 changes: 9 additions & 1 deletion dist/releaseNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ <h3><a href='http://schemaspy.sourceforge.net'>SchemaSpy</a> Release Notes</h3>

<li class='release'>x.x.x - xx/xx/xxxx - Subversion revision xxx
<ul>
<li>When dealing with multiple schemas it now passes all regular expressions
<li>Resolved <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=3296973&group_id=137197&atid=737987">
bug 3296973</a> - Tables not included with -i appears in relationship tab<br>
rev 643<br>
Thanks to Lennart Jonsson for reporting the issue.
</li>
<li>Refactored to no longer require database properties and column exclusions being
passed throughout the code.
</li>
<li>When dealing with multiple schemas all regular expressions are now passed
to child processes in the environment.
This is to resolve the problem where some operating system shells expanded
the regular expressions as if they were file specifications.<br>
Expand Down
36 changes: 31 additions & 5 deletions src/main/java/net/sourceforge/schemaspy/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public class Config
private String font;
private Integer fontSize;
private String description;
private Properties dbProperties;
private String dbPropertiesLoadedFrom;
private Level logLevel;
private SqlFormatter sqlFormatter;
Expand Down Expand Up @@ -693,7 +694,7 @@ public int getMaxDbThreads() throws InvalidConfigurationException {
if (maxDbThreads == null) {
Properties properties;
try {
properties = getDbProperties(getDbType());
properties = determineDbProperties(getDbType());
} catch (IOException exc) {
throw new InvalidConfigurationException("Failed to load properties for " + getDbType() + ": " + exc)
.setParamName("-type");
Expand Down Expand Up @@ -1317,12 +1318,34 @@ public boolean hasRoutines() {
}

/**
* Returns the database properties to use.
* These should be determined by calling {@link #determineDbProperties(String)}.
* @return
* @throws InvalidConfigurationException
*/
public Properties getDbProperties() throws InvalidConfigurationException {
if (dbProperties == null) {
try {
dbProperties = determineDbProperties(getDbType());
} catch (IOException exc) {
throw new InvalidConfigurationException(exc);
}
}

return dbProperties;
}

/**
* Determines the database properties associated with the specified type.
* A call to {@link #setDbProperties(Properties)} is expected after determining
* the complete set of properties.
*
* @param type
* @return
* @throws IOException
* @throws InvalidConfigurationException if db properties are incorrectly formed
*/
public Properties getDbProperties(String type) throws IOException, InvalidConfigurationException {
public Properties determineDbProperties(String type) throws IOException, InvalidConfigurationException {
ResourceBundle bundle = null;

try {
Expand Down Expand Up @@ -1372,15 +1395,15 @@ public Properties getDbProperties(String type) throws IOException, InvalidConfig
String refdKey = include.substring(separator + 2).trim();

// recursively resolve the ref'd properties file and the ref'd key
Properties refdProps = getDbProperties(refdType);
Properties refdProps = determineDbProperties(refdType);
props.put(refdKey, refdProps.getProperty(refdKey));
}

// bring in base properties files pointed to by the extends directive
String baseDbType = (String)props.remove("extends");
if (baseDbType != null) {
baseDbType = baseDbType.trim();
Properties baseProps = getDbProperties(baseDbType);
Properties baseProps = determineDbProperties(baseDbType);

// overlay our properties on top of the base's
baseProps.putAll(props);
Expand All @@ -1390,12 +1413,15 @@ public Properties getDbProperties(String type) throws IOException, InvalidConfig
// done with this level of recursion...restore original
dbPropertiesLoadedFrom = saveLoadedFrom;

// this won't be correct until the final recursion exits
dbProperties = props;

return props;
}

protected String getDbPropertiesLoadedFrom() throws IOException {
if (dbPropertiesLoadedFrom == null)
getDbProperties(getDbType());
determineDbProperties(getDbType());
return dbPropertiesLoadedFrom;
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/net/sourceforge/schemaspy/SchemaAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public Database analyze(Config config) throws Exception {
return null;
}

Properties properties = config.getDbProperties(config.getDbType());
Properties properties = config.determineDbProperties(config.getDbType());

ConnectionURLBuilder urlBuilder = new ConnectionURLBuilder(config, properties);
if (config.getDb() == null)
Expand Down Expand Up @@ -214,8 +214,7 @@ public Database analyze(Config config) throws Exception {
//
// create our representation of the database
//
Database db = new Database(config, connection, meta,
dbName, catalog, schema, properties, schemaMeta);
Database db = new Database(config, connection, meta, dbName, catalog, schema, schemaMeta);

schemaMeta = null; // done with it so let GC reclaim it

Expand Down
Loading

0 comments on commit 660385e

Please sign in to comment.