[
https://issues.apache.org/jira/browse/DIRSTUDIO-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seelmann updated DIRSTUDIO-1059:
---------------------------------------
Issue Type: Improvement (was: Bug)
> 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: Improvement
> Components: studio-connection
> Affects Versions: 2.0.0-M9 (2.0.0.v20150606-M9)
> Reporter: Emmanuel Lécharny
> Priority: Minor
>
> 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
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]