Revision: 3930
Author: [email protected]
Date: Fri Aug 27 12:00:46 2010
Log: Fixed a bug with the ArchitectClientSideSession where
DataSourceCollections retrieved from the server would replace the local
copy. Newly added database connections would not appear until you refreshed
the project.
http://code.google.com/p/power-architect/source/detail?r=3930
Modified:
/trunk/src/main/java/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java
Wed Aug 25 08:24:31 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java
Fri Aug 27 12:00:46 2010
@@ -372,11 +372,11 @@
@Override
public DataSourceCollection<JDBCDataSource> getDataSources() {
- if (dataSourceCollection != null) {
- return dataSourceCollection;
- } else {
- return getDataSourcesFromServer();
- }
+ if (dataSourceCollection == null) {
+ dataSourceCollection = getDataSourcesFromServer();
+ dataSourceCollectionUpdater.attach(dataSourceCollection);
+ }
+ return dataSourceCollection;
}
private DataSourceCollection<JDBCDataSource> getDataSourcesFromServer()
{
@@ -455,8 +455,9 @@
}
};
+ DataSourceCollection<JDBCDataSource> dsc;
try {
- dataSourceCollection =
executeServerRequest(outboundHttpClient, projectLocation.getServiceInfo(),
+ dsc = executeServerRequest(outboundHttpClient,
projectLocation.getServiceInfo(),
"/" + REST_TAG + "/data-sources/", plIniHandler);
} catch (AccessDeniedException e) {
throw e;
@@ -464,9 +465,7 @@
throw new RuntimeException(ex);
}
- dataSourceCollectionUpdater.attach(dataSourceCollection);
-
- return dataSourceCollection;
+ return dsc;
}
public void startUpdaterThread() {