Emmanuel Lecharny created DIRSTUDIO-1059:
--------------------------------------------
Summary: The schema is written twice ondisk when a connection is
created
Key: DIRSTUDIO-1059
URL: https://issues.apache.org/jira/browse/DIRSTUDIO-1059
Project: Directory Studio
Issue Type: Bug
Components: studio-connection
Affects Versions: 2.0.0-M9 (2.0.0.v20150606-M9)
Reporter: Emmanuel Lecharny
Priority: Minor
Fix For: 2.0.0-M10
When we create a new connection, we will fetch the schema from this server (if
it's available) or use a default schema. This schema will be associated with
this connection, and stored on disk by a call to this method :
{{BrowserConnectionManager.saveSchema( IBrowserConnection browserConnection )}}
This is done twice, becuase this method is called when two events are fired :
{code}
public void browserConnectionUpdated( BrowserConnectionUpdateEvent
browserConnectionUpdateEvent )
{
if ( browserConnectionUpdateEvent.getDetail() ==
BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_OPENED
|| browserConnectionUpdateEvent.getDetail() ==
BrowserConnectionUpdateEvent.Detail.SCHEMA_UPDATED )
{
saveSchema( browserConnectionUpdateEvent.getBrowserConnection() );
}
}
{code}
and those events are fired in the {{BrowseConnectionListener.connectionOpened}}
method :
{code}
public void connectionOpened( Connection connection, StudioProgressMonitor
monitor )
{
IBrowserConnection browserConnection =
BrowserCorePlugin.getDefault().getConnectionManager()
.getBrowserConnection( connection );
if ( browserConnection != null )
{
try
{
...
}
finally
{
....
BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new
BrowserConnectionUpdateEvent(
browserConnection,
BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_OPENED );
...
BrowserConnectionUpdateEvent schemaUpdateEvent = new
BrowserConnectionUpdateEvent( browserConnection,
BrowserConnectionUpdateEvent.Detail.SCHEMA_UPDATED );
....
}
}
}
{code}
I suspect we can get rid of the second event, except that I think it was added
to do more than just saving the schema.
Ideally, we should *not* save the schema when the {{BROWSER_CONNECTION_OPENED}}
event is fired.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)