Uploaded image for project: 'Directory Studio'
  1. Directory Studio
  2. DIRSTUDIO-1059

The schema is written twice ondisk when a connection is created

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.0-M9 (2.0.0.v20150606-M9)
    • None
    • studio-connection
    • None

    Description

      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 :

          public void browserConnectionUpdated( BrowserConnectionUpdateEvent browserConnectionUpdateEvent )
          {
              if ( browserConnectionUpdateEvent.getDetail() == BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_OPENED
                  || browserConnectionUpdateEvent.getDetail() == BrowserConnectionUpdateEvent.Detail.SCHEMA_UPDATED )
              {
                  saveSchema( browserConnectionUpdateEvent.getBrowserConnection() );
              }
          }
      

      and those events are fired in the BrowseConnectionListener.connectionOpened method :

          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 );
                      ....
                  }
              }
          }
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            elecharny Emmanuel Lécharny
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: